Skip to main content

query_history

Creates, updates, deletes, gets or lists a query_history resource.

Overview

Namequery_history
TypeResource
Iddatabricks_workspace.dbsql.query_history

Fields

The following fields are returned by SELECT queries:

Request completed successfully.

NameDatatypeDescription
endpoint_idstring
executed_as_user_idinteger
query_idstring
user_idinteger
warehouse_idstring
executed_as_user_namestring
user_namestring
channel_usedobject
durationinteger
error_messagestring
execution_end_time_msinteger
is_finalboolean
lookup_keystring
metricsobject
plans_statestring
query_end_time_msinteger
query_start_time_msinteger
query_textstring
rows_producedinteger
spark_ui_urlstring
statement_typestring
statusstring

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectdeployment_nameList the history of queries through SQL warehouses, and serverless compute.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)

SELECT examples

List the history of queries through SQL warehouses, and serverless compute.

SELECT
endpoint_id,
executed_as_user_id,
query_id,
user_id,
warehouse_id,
executed_as_user_name,
user_name,
channel_used,
duration,
error_message,
execution_end_time_ms,
is_final,
lookup_key,
metrics,
plans_state,
query_end_time_ms,
query_start_time_ms,
query_text,
rows_produced,
spark_ui_url,
statement_type,
status
FROM databricks_workspace.dbsql.query_history
WHERE deployment_name = '{{ deployment_name }}' -- required;