Execute query with SQL Warehouse
Usage
db_sql_query(
warehouse_id,
statement,
schema = NULL,
catalog = NULL,
parameters = NULL,
row_limit = NULL,
byte_limit = NULL,
wait_timeout = "5s",
return_arrow = FALSE,
max_active_connections = 30,
fetch_timeout = 300,
disposition = "EXTERNAL_LINKS",
host = db_host(),
token = db_token(),
show_progress = TRUE
)Arguments
- warehouse_id
String, ID of warehouse upon which to execute a statement.
- statement
String, the SQL statement to execute. The statement can optionally be parameterized, see
parameters.- schema
String, sets default schema for statement execution, similar to
USE SCHEMAin SQL.- catalog
String, sets default catalog for statement execution, similar to
USE CATALOGin SQL.- parameters
List of Named Lists, parameters to pass into a SQL statement containing parameter markers.
A parameter consists of a name, a value, and optionally a type. To represent a
NULLvalue, the value field may be omitted or set toNULLexplicitly.See docs for more details.
- row_limit
Integer, applies the given row limit to the statement's result set, but unlike the
LIMITclause in SQL, it also sets thetruncatedfield in the response to indicate whether the result was trimmed due to the limit or not.- byte_limit
Integer, applies the given byte limit to the statement's result size. Byte counts are based on internal data representations and might not match the final size in the requested format. If the result was truncated due to the byte limit, then
truncatedin the response is set to true. When usingEXTERNAL_LINKSdisposition, a default byte_limit of 100 GiB is applied ifbyte_limitis not explicitly set.- wait_timeout
String, default is
"10s". The time in seconds the call will wait for the statement's result set asNs, whereNcan be set to0or to a value between5and50. When set to0s, the statement will execute in asynchronous mode and the call will not wait for the execution to finish. In this case, the call returns directly withPENDINGstate and a statement ID which can be used for polling withdb_sql_exec_status().When set between
5and50seconds, the call will behave synchronously up to this timeout and wait for the statement execution to finish. If the execution finishes within this time, the call returns immediately with a manifest and result data (or aFAILEDstate in case of an execution error).If the statement takes longer to execute,
on_wait_timeoutdetermines what should happen after the timeout is reached.- return_arrow
Boolean, determine if result is tibble::tibble or arrow::Table.
- max_active_connections
Integer to decide on concurrent downloads.
- fetch_timeout
Integer, timeout in seconds for downloading each result chunk
- disposition
Disposition mode ("INLINE" or "EXTERNAL_LINKS")
- host
Databricks workspace URL, defaults to calling
db_host().- token
Databricks workspace token, defaults to calling
db_token().- show_progress
If
TRUE, show progress updates during query execution (default:TRUE)
Value
tibble::tibble or arrow::Table.
