Python
import os
from samplehc import SampleHealthcare
client = SampleHealthcare(
api_key=os.environ.get("SAMPLEHC_API_KEY"), # This is the default and can be omitted
)
response = client.v2.database.execute_sql(
query="query",
)
print(response.rows){
"rows": [
{}
]
}{
"error": "<string>"
}{
"error": "<string>"
}Database
Execute SQL query
Allows execution of arbitrary SQL queries against the Sample database. Supports parameterized queries with complex data types including arrays, objects, and nested structures. Examples: arrays can be used with ANY/ALL operators, objects as structs for complex filtering.
POST
/
api
/
v2
/
database
/
sql
Python
import os
from samplehc import SampleHealthcare
client = SampleHealthcare(
api_key=os.environ.get("SAMPLEHC_API_KEY"), # This is the default and can be omitted
)
response = client.v2.database.execute_sql(
query="query",
)
print(response.rows){
"rows": [
{}
]
}{
"error": "<string>"
}{
"error": "<string>"
}Body
application/json
The SQL query to execute.
An array of parameters to be used in the SQL query. Supports primitive types (string, number, boolean, null), arrays, and objects. Use placeholders like $1, $2, etc. in the query string. Examples: ["hello", 123, [1,2,3], {"name": "John", "age": 30}]
Response
The result of the SQL query execution.
An array of results from the query. Each item is an object with the column names as keys.