Error
A valid request URL is required to generate request examples{
"results": {
"resolvedTimezone": "<string>",
"usedParametersValues": {},
"parameterReferences": [
"<string>"
],
"cacheMetadata": {
"cacheHit": true,
"preAggregate": {
"hit": true,
"reason": {
"reason": "no_pre_aggregates_defined"
},
"name": "<string>"
},
"queryReuseHit": true,
"cacheKey": "<string>",
"cacheExpiresAt": "2023-11-07T05:31:56Z",
"cacheUpdatedTime": "2023-11-07T05:31:56Z"
},
"queryUuid": "<string>"
},
"status": "ok"
}{
"error": {
"name": "<string>",
"statusCode": 123,
"data": "<unknown>",
"message": "<string>"
},
"status": "error"
}v2
Execute python query
Executes python `run(inputs, params)` asynchronously in an isolated sandbox over other async queries' results. Requires run-queries access (interactive viewer and up) and the compose-sql-runner feature flag. The references map exposes other queries' results as pandas DataFrames in `inputs` ({"orders": "queryUuid"} is read as inputs["orders"]); each referenced query is authorized with the same access checks as Get results and still-running references are waited on. The returned DataFrame is validated, capped at `limit` rows and stored as a regular result. The sandbox has no network access and no credentials. Returns a queryUuid to poll for results via Get results.
POST
/
api
/
v2
/
projects
/
{projectUuid}
/
query
/
python
Error
A valid request URL is required to generate request examples{
"results": {
"resolvedTimezone": "<string>",
"usedParametersValues": {},
"parameterReferences": [
"<string>"
],
"cacheMetadata": {
"cacheHit": true,
"preAggregate": {
"hit": true,
"reason": {
"reason": "no_pre_aggregates_defined"
},
"name": "<string>"
},
"queryReuseHit": true,
"cacheKey": "<string>",
"cacheExpiresAt": "2023-11-07T05:31:56Z",
"cacheUpdatedTime": "2023-11-07T05:31:56Z"
},
"queryUuid": "<string>"
},
"status": "ok"
}{
"error": {
"name": "<string>",
"statusCode": 123,
"data": "<unknown>",
"message": "<string>"
},
"status": "error"
}Path Parameters
Body
application/json
Python run(inputs, params) over other async queries' results, executed in a sandbox.
Results of other async queries exposed to the code as DataFrames, keyed by input name: {"orders": ""} is read as inputs["orders"]. Typed Record<string, UUID> for the same TSOA reason as compose SQL.
Show child attributes
Show child attributes
Python source defining run(inputs: dict[str, pandas.DataFrame], params: dict) -> pandas.DataFrame.
Each key of references is exposed in inputs as a DataFrame.
Construct a type with a set of properties K of type T
Show child attributes
Show child attributes
Available options:
dashboardView, autorefreshedDashboard, exploreView, filterAutocomplete, chartView, chartHistory, sqlChartView, sqlRunner, viewUnderlyingData, alert, scheduledDelivery, csvDownload, gsheets, gsheetsAddon, scheduledGsheetsChart, scheduledGsheetsDashboard, scheduledGsheetsSqlChart, scheduledChart, scheduledDashboard, calculateTotal, calculateSubtotal, embed, ai, mcp.run_metric_query, mcp.run_sql, mcp.search_field_values, api, cli, metricsExplorer, preAggregateMaterialization, composeSqlRunner, pythonRunner, multiSourceQuery, dataAppSample, desktop Maximum rows kept from the returned DataFrame; the rest are dropped and the result marked truncated.
Was this page helpful?