query_history
Creates, updates, deletes, gets or lists a query_history resource.
Overview
| Name | query_history |
| Type | Resource |
| Id | databricks_workspace.sql.query_history |
Fields
The following fields are returned by SELECT queries:
- list
| Name | Datatype | Description |
|---|---|---|
has_next_page | boolean | |
next_page_token | string | A token that can be used to get the next page of results. |
res | array |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | deployment_name | filter_by, include_metrics, max_results, page_token | List 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.
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
filter_by | object | An optional filter object to limit query history results. Accepts parameters such as user IDs, endpoint IDs, and statuses to narrow the returned data. In a URL, the parameters of this filter are specified with dot notation. For example: filter_by.statement_ids. |
include_metrics | boolean | Whether to include the query metrics with each query. Only use this for a small subset of queries (max_results). Defaults to false. |
max_results | integer | Limit the number of results returned in one page. Must be less than 1000 and the default is 100. |
page_token | string | A token that can be used to get the next page of results. The token can contains characters that need to be encoded before using it in a URL. For example, the character '+' needs to be replaced by %2B. This field is optional. |
SELECT examples
- list
List the history of queries through SQL warehouses, and serverless compute.
SELECT
has_next_page,
next_page_token,
res
FROM databricks_workspace.sql.query_history
WHERE deployment_name = '{{ deployment_name }}' -- required
AND filter_by = '{{ filter_by }}'
AND include_metrics = '{{ include_metrics }}'
AND max_results = '{{ max_results }}'
AND page_token = '{{ page_token }}'
;