Execute a query

queries_post(
  database,
  sql,
  preview_rows,
  credential = NULL,
  hidden = NULL,
  interactive = NULL,
  include_header = NULL,
  compression = NULL,
  column_delimiter = NULL,
  unquoted = NULL,
  filename_prefix = NULL
)

Arguments

database

integer required. The database ID.

sql

string required. The SQL to execute.

preview_rows

integer required. The number of rows to save from the query's result (maximum: 100).

credential

integer optional. The credential ID.

hidden

boolean optional. The hidden status of the item.

interactive

boolean optional. Deprecated and not used.

include_header

boolean optional. Whether the CSV output should include a header row [default: true].

compression

string optional. The type of compression. One of gzip or zip, or none [default: gzip].

column_delimiter

string optional. The delimiter to use. One of comma or tab, or pipe [default: comma].

unquoted

boolean optional. If true, will not quote fields.

filename_prefix

string optional. The output filename prefix.

Value

A list containing the following elements:

id

integer, The query ID.

database

integer, The database ID.

sql

string, The SQL to execute.

credential

integer, The credential ID.

resultRows

array, A preview of rows returned by the query.

resultColumns

array, A preview of columns returned by the query.

scriptId

integer, The ID of the script associated with this query.

exception

string, Deprecated and not used.

error

string, The error message for this run, if present.

createdAt

string,

updatedAt

string,

finishedAt

string, The end time of the last run.

state

string, The state of the last run.

lastRunId

integer, The ID of the last run.

hidden

boolean, The hidden status of the item.

interactive

boolean, Deprecated and not used.

previewRows

integer, The number of rows to save from the query's result (maximum: 100).

includeHeader

boolean, Whether the CSV output should include a header row [default: true].

compression

string, The type of compression. One of gzip or zip, or none [default: gzip].

columnDelimiter

string, The delimiter to use. One of comma or tab, or pipe [default: comma].

unquoted

boolean, If true, will not quote fields.

filenamePrefix

string, The output filename prefix.

startedAt

string, The start time of the last run.

reportId

integer, The ID of the report associated with this query.