queries_legacy
Creates, updates, deletes, gets or lists a queries_legacy
resource.
Overview
Name | queries_legacy |
Type | Resource |
Id | databricks_workspace.dbsql.queries_legacy |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Query fetched successfully.
Name | Datatype | Description |
---|---|---|
id | string | |
name | string | |
data_source_id | string | |
last_modified_by_id | integer | |
latest_query_data_id | string | |
user_id | integer | |
can_edit | boolean | |
created_at | string | |
description | string | |
is_archived | boolean | |
is_draft | boolean | |
is_favorite | boolean | |
is_safe | boolean | |
last_modified_by | object | |
options | object | |
parent | string | |
permission_tier | string | |
query | string | |
query_hash | string | |
run_as_role | string | |
tags | array | |
updated_at | string | |
user | object | |
visualizations | array |
Name | Datatype | Description |
---|---|---|
id | string | |
name | string | |
data_source_id | string | |
last_modified_by_id | integer | |
latest_query_data_id | string | |
user_id | integer | |
can_edit | boolean | |
created_at | string | |
description | string | |
is_archived | boolean | |
is_draft | boolean | |
is_favorite | boolean | |
is_safe | boolean | |
last_modified_by | object | |
options | object | |
parent | string | |
permission_tier | string | |
query | string | |
query_hash | string | |
run_as_role | string | |
tags | array | |
updated_at | string | |
user | object | |
visualizations | array |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | deployment_name | Retrieve a query object definition along with contextual permissions information about the currently authenticated user. | |
list | select | deployment_name | Gets a list of queries. Optionally, this list can be filtered by a search term. | |
create | insert | deployment_name | Creates a new query definition. Queries created with this endpoint belong to the authenticated user making the request. | |
update | update | deployment_name | Modify this query definition. | |
delete | delete | deployment_name | Moves a query to the trash. Trashed queries immediately disappear from searches and list views, and they cannot be used for alerts. The trash is deleted after 30 days. | |
restore | exec | deployment_name | Restore a query that has been moved to the trash. A restored query appears in list views and searches. You can use restored queries for alerts. |
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) |
SELECT
examples
- get
- list
Retrieve a query object definition along with contextual permissions information about the currently authenticated user.
SELECT
id,
name,
data_source_id,
last_modified_by_id,
latest_query_data_id,
user_id,
can_edit,
created_at,
description,
is_archived,
is_draft,
is_favorite,
is_safe,
last_modified_by,
options,
parent,
permission_tier,
query,
query_hash,
run_as_role,
tags,
updated_at,
user,
visualizations
FROM databricks_workspace.dbsql.queries_legacy
WHERE deployment_name = '{{ deployment_name }}' -- required;
Gets a list of queries. Optionally, this list can be filtered by a search term.
SELECT
id,
name,
data_source_id,
last_modified_by_id,
latest_query_data_id,
user_id,
can_edit,
created_at,
description,
is_archived,
is_draft,
is_favorite,
is_safe,
last_modified_by,
options,
parent,
permission_tier,
query,
query_hash,
run_as_role,
tags,
updated_at,
user,
visualizations
FROM databricks_workspace.dbsql.queries_legacy
WHERE deployment_name = '{{ deployment_name }}' -- required;
INSERT
examples
- create
- Manifest
Creates a new query definition. Queries created with this endpoint belong to the authenticated user making the request.
INSERT INTO databricks_workspace.dbsql.queries_legacy (
data__data_source_id,
data__query,
data__name,
data__parent,
data__description,
data__options,
data__run_as_role,
data__tags,
deployment_name
)
SELECT
'{{ data_source_id }}',
'{{ query }}',
'{{ name }}',
'{{ parent }}',
'{{ description }}',
'{{ options }}',
'{{ run_as_role }}',
'{{ tags }}',
'{{ deployment_name }}'
RETURNING
id,
name,
data_source_id,
last_modified_by_id,
latest_query_data_id,
user_id,
can_edit,
created_at,
description,
is_archived,
is_draft,
is_favorite,
is_safe,
last_modified_by,
options,
parent,
permission_tier,
query,
query_hash,
run_as_role,
tags,
updated_at,
user,
visualizations
;
# Description fields are for documentation purposes
- name: queries_legacy
props:
- name: deployment_name
value: string
description: Required parameter for the queries_legacy resource.
- name: data_source_id
value: UUID
- name: query
value: string
- name: name
value: string
- name: parent
value: string
- name: description
value: string
- name: options
value: object
- name: run_as_role
value: string
- name: tags
value: Array of string
UPDATE
examples
- update
Modify this query definition.
UPDATE databricks_workspace.dbsql.queries_legacy
SET
data__data_source_id = '{{ data_source_id }}',
data__query = '{{ query }}',
data__name = '{{ name }}',
data__description = '{{ description }}',
data__options = '{{ options }}',
data__run_as_role = '{{ run_as_role }}',
data__tags = '{{ tags }}'
WHERE
deployment_name = '{{ deployment_name }}' --required
RETURNING
id,
name,
data_source_id,
last_modified_by_id,
latest_query_data_id,
user_id,
can_edit,
created_at,
description,
is_archived,
is_draft,
is_favorite,
is_safe,
last_modified_by,
options,
parent,
permission_tier,
query,
query_hash,
run_as_role,
tags,
updated_at,
user,
visualizations;
DELETE
examples
- delete
Moves a query to the trash. Trashed queries immediately disappear from searches and list views, and they cannot be used for alerts. The trash is deleted after 30 days.
DELETE FROM databricks_workspace.dbsql.queries_legacy
WHERE deployment_name = '{{ deployment_name }}' --required;
Lifecycle Methods
- restore
Restore a query that has been moved to the trash. A restored query appears in list views and searches. You can use restored queries for alerts.
EXEC databricks_workspace.dbsql.queries_legacy.restore
@deployment_name='{{ deployment_name }}' --required;