Run SQL Interface Query

Version 4.0.24.16 (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...
metadata
Metadata about the query
Expand JsonBiMetadata definition...
big_query_metadata
Metadata returned from Bigquery. Null if any other dialect.
fields
Fields
pivots
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
rows
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