Run SQL Interface Query

Version 4.0.24.2 (latest)

Run a saved SQL interface query.

This runs a previously created SQL interface query.

The 'result_format' parameter specifies the desired structure and format of the response.

Supported formats:

result_format Description
json Plain json
json_bi (RECOMMENDED) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
json_detail (LEGACY) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
csv Comma separated values with a header
txt Tab separated values with a header
html Simple html
md Simple markdown
xlsx MS Excel spreadsheet
sql Returns the generated SQL rather than running the query

Request

GET /sql_interface_queries/{query_id}/run/{result_format}
Datatype
Description
Request
HTTP Request
path
HTTP Path
Expand HTTP Path definition...
query_id
integer
Integer id of query
result_format
string
Format of result, options are: ["json_bi"]

Response

200: Query Formats

Datatype
Description
(object)
json_bi
Expand JsonBi definition...
big_query_metadata
Metadata returned from Bigquery. Null if any other dialect.
Expand JsonBiBigQueryMetadata definition...
total_bytes_processed
integer
Total bytes processed by the BigQuery job
backend_cache_hit
boolean
Return whether or not query results were served from the BigQuery cache.
fields
Fields
Expand JsonBiFields definition...
dimensions
measures
pivots
pivots
Expand JsonBiPivots definition...
key
string
Pivot Column Value
data
object
Pivot Data
sort_values
object
Pivot Sort Values
is_total
boolean
If the value is a total
has_subtotals
boolean
If the query has subtotals
has_totals
boolean
If the query has totals
columns_truncated
string
If the query results hit the maximum column limit and additional columns were truncated
filter_expression
string
Filter expression applied to the query results
filters
object
Filters applied to the query results
sql
string
Raw sql query. Null if user does not have permission to view sql
data
string[]
json
string
json_detail
string
csv
string
txt
string
html
string
md
string
xlsx
string
sql
string

400: Bad Request

Datatype
Description
(object)
message
string
Error details
documentation_url
string
Documentation link

403: Permission Denied

Datatype
Description
(object)
message
string
Error details
documentation_url
string
Documentation link

404: Not Found

Datatype
Description
(object)
message
string
Error details
documentation_url
string
Documentation link

422: Validation Error

Datatype
Description
(object)
message
string
Error details
Expand ValidationErrorDetail definition...
field
string
Field with error
code
string
Error code
message
string
Error info message
documentation_url
string
Documentation link
documentation_url
string
Documentation link

429: Too Many Requests

Datatype
Description
(object)
message
string
Error details
documentation_url
string
Documentation link