tables
Creates, updates, deletes, gets or lists a tables resource.
Overview
| Name | tables |
| Type | Resource |
| Id | databricks_workspace.catalog.tables |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
name | string | Name of table, relative to parent schema. |
data_access_configuration_id | string | Unique ID of the Data Access Configuration to use with the table data. |
metastore_id | string | Unique identifier of parent metastore. |
pipeline_id | string | The pipeline ID of the table. Applicable for tables created by pipelines (Materialized View, Streaming Table, etc.). |
table_id | string | The unique identifier of the table. |
catalog_name | string | Name of parent catalog. |
full_name | string | Full name of table, in form of __catalog_name__.__schema_name__.__table_name__ |
schema_name | string | Name of parent schema relative to its parent catalog. |
storage_credential_name | string | Name of the storage credential, when a storage credential is configured for use with this table. |
access_point | string | |
browse_only | boolean | Indicates whether the principal is limited to retrieving metadata for the associated object through the BROWSE privilege when include_browse is enabled in the request. |
columns | array | The array of __ColumnInfo__ definitions of the table's columns. |
comment | string | User-provided free-form text description. |
created_at | integer | Time at which this table was created, in epoch milliseconds. |
created_by | string | Username of table creator. |
data_source_format | string | Data source format (AVRO, BIGQUERY_FORMAT, CSV, DATABRICKS_FORMAT, DATABRICKS_ROW_STORE_FORMAT, DELTA, DELTASHARING, DELTA_UNIFORM_HUDI, DELTA_UNIFORM_ICEBERG, HIVE, ICEBERG, JSON, MONGODB_FORMAT, MYSQL_FORMAT, NETSUITE_FORMAT, ORACLE_FORMAT, ORC, PARQUET, POSTGRESQL_FORMAT, REDSHIFT_FORMAT, SALESFORCE_DATA_CLOUD_FORMAT, SALESFORCE_FORMAT, SNOWFLAKE_FORMAT, SQLDW_FORMAT, SQLSERVER_FORMAT, TERADATA_FORMAT, TEXT, UNITY_CATALOG, VECTOR_INDEX_FORMAT, WORKDAY_RAAS_FORMAT) |
deleted_at | integer | Time at which this table was deleted, in epoch milliseconds. Field is omitted if table is not deleted. |
delta_runtime_properties_kvpairs | object | Information pertaining to current state of the delta table. |
effective_predictive_optimization_flag | object | |
enable_predictive_optimization | string | Create a collection of name/value pairs.<br /><br />Example enumeration:<br /><br />>>> class Color(Enum):<br />... RED = 1<br />... BLUE = 2<br />... GREEN = 3<br /><br />Access them by:<br /><br />- attribute access::<br /><br />>>> Color.RED<br /><Color.RED: 1><br /><br />- value lookup:<br /><br />>>> Color(1)<br /><Color.RED: 1><br /><br />- name lookup:<br /><br />>>> Color['RED']<br /><Color.RED: 1><br /><br />Enumerations can be iterated over, and know how many members they have:<br /><br />>>> len(Color)<br />3<br /><br />>>> list(Color)<br />[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]<br /><br />Methods can be added to enumerations, and members can have their own<br />attributes -- see the documentation for details. (DISABLE, ENABLE, INHERIT) |
encryption_details | object | Encryption options that apply to clients connecting to cloud storage. |
owner | string | Username of current owner of table. |
properties | object | A map of key-value properties attached to the securable. |
row_filter | object | |
securable_kind_manifest | object | SecurableKindManifest of table, including capabilities the table has. |
sql_path | string | List of schemes whose objects can be referenced without qualification. |
storage_location | string | Storage root URL for table (for **MANAGED**, **EXTERNAL** tables). |
table_constraints | array | List of table constraints. Note: this field is not set in the output of the __listTables__ API. |
table_type | string | Create a collection of name/value pairs.<br /><br />Example enumeration:<br /><br />>>> class Color(Enum):<br />... RED = 1<br />... BLUE = 2<br />... GREEN = 3<br /><br />Access them by:<br /><br />- attribute access::<br /><br />>>> Color.RED<br /><Color.RED: 1><br /><br />- value lookup:<br /><br />>>> Color(1)<br /><Color.RED: 1><br /><br />- name lookup:<br /><br />>>> Color['RED']<br /><Color.RED: 1><br /><br />Enumerations can be iterated over, and know how many members they have:<br /><br />>>> len(Color)<br />3<br /><br />>>> list(Color)<br />[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]<br /><br />Methods can be added to enumerations, and members can have their own<br />attributes -- see the documentation for details. (EXTERNAL, EXTERNAL_SHALLOW_CLONE, FOREIGN, MANAGED, MANAGED_SHALLOW_CLONE, MATERIALIZED_VIEW, METRIC_VIEW, STREAMING_TABLE, VIEW) |
updated_at | integer | Time at which this table was last modified, in epoch milliseconds. |
updated_by | string | Username of user who last modified the table. |
view_definition | string | View definition SQL (when __table_type__ is **VIEW**, **MATERIALIZED_VIEW**, or **STREAMING_TABLE**) |
view_dependencies | object | View dependencies (when table_type == **VIEW** or **MATERIALIZED_VIEW**, **STREAMING_TABLE**) - when DependencyList is None, the dependency is not provided; - when DependencyList is an empty list, the dependency is provided but is empty; - when DependencyList is not an empty list, dependencies are provided and recorded. Note: this field is not set in the output of the __listTables__ API. |
| Name | Datatype | Description |
|---|---|---|
name | string | Name of table, relative to parent schema. |
data_access_configuration_id | string | Unique ID of the Data Access Configuration to use with the table data. |
metastore_id | string | Unique identifier of parent metastore. |
pipeline_id | string | The pipeline ID of the table. Applicable for tables created by pipelines (Materialized View, Streaming Table, etc.). |
table_id | string | The unique identifier of the table. |
catalog_name | string | Name of parent catalog. |
full_name | string | Full name of table, in form of __catalog_name__.__schema_name__.__table_name__ |
schema_name | string | Name of parent schema relative to its parent catalog. |
storage_credential_name | string | Name of the storage credential, when a storage credential is configured for use with this table. |
access_point | string | |
browse_only | boolean | Indicates whether the principal is limited to retrieving metadata for the associated object through the BROWSE privilege when include_browse is enabled in the request. |
columns | array | The array of __ColumnInfo__ definitions of the table's columns. |
comment | string | User-provided free-form text description. |
created_at | integer | Time at which this table was created, in epoch milliseconds. |
created_by | string | Username of table creator. |
data_source_format | string | Data source format (AVRO, BIGQUERY_FORMAT, CSV, DATABRICKS_FORMAT, DATABRICKS_ROW_STORE_FORMAT, DELTA, DELTASHARING, DELTA_UNIFORM_HUDI, DELTA_UNIFORM_ICEBERG, HIVE, ICEBERG, JSON, MONGODB_FORMAT, MYSQL_FORMAT, NETSUITE_FORMAT, ORACLE_FORMAT, ORC, PARQUET, POSTGRESQL_FORMAT, REDSHIFT_FORMAT, SALESFORCE_DATA_CLOUD_FORMAT, SALESFORCE_FORMAT, SNOWFLAKE_FORMAT, SQLDW_FORMAT, SQLSERVER_FORMAT, TERADATA_FORMAT, TEXT, UNITY_CATALOG, VECTOR_INDEX_FORMAT, WORKDAY_RAAS_FORMAT) |
deleted_at | integer | Time at which this table was deleted, in epoch milliseconds. Field is omitted if table is not deleted. |
delta_runtime_properties_kvpairs | object | Information pertaining to current state of the delta table. |
effective_predictive_optimization_flag | object | |
enable_predictive_optimization | string | Create a collection of name/value pairs.<br /><br />Example enumeration:<br /><br />>>> class Color(Enum):<br />... RED = 1<br />... BLUE = 2<br />... GREEN = 3<br /><br />Access them by:<br /><br />- attribute access::<br /><br />>>> Color.RED<br /><Color.RED: 1><br /><br />- value lookup:<br /><br />>>> Color(1)<br /><Color.RED: 1><br /><br />- name lookup:<br /><br />>>> Color['RED']<br /><Color.RED: 1><br /><br />Enumerations can be iterated over, and know how many members they have:<br /><br />>>> len(Color)<br />3<br /><br />>>> list(Color)<br />[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]<br /><br />Methods can be added to enumerations, and members can have their own<br />attributes -- see the documentation for details. (DISABLE, ENABLE, INHERIT) |
encryption_details | object | Encryption options that apply to clients connecting to cloud storage. |
owner | string | Username of current owner of table. |
properties | object | A map of key-value properties attached to the securable. |
row_filter | object | |
securable_kind_manifest | object | SecurableKindManifest of table, including capabilities the table has. |
sql_path | string | List of schemes whose objects can be referenced without qualification. |
storage_location | string | Storage root URL for table (for **MANAGED**, **EXTERNAL** tables). |
table_constraints | array | List of table constraints. Note: this field is not set in the output of the __listTables__ API. |
table_type | string | Create a collection of name/value pairs.<br /><br />Example enumeration:<br /><br />>>> class Color(Enum):<br />... RED = 1<br />... BLUE = 2<br />... GREEN = 3<br /><br />Access them by:<br /><br />- attribute access::<br /><br />>>> Color.RED<br /><Color.RED: 1><br /><br />- value lookup:<br /><br />>>> Color(1)<br /><Color.RED: 1><br /><br />- name lookup:<br /><br />>>> Color['RED']<br /><Color.RED: 1><br /><br />Enumerations can be iterated over, and know how many members they have:<br /><br />>>> len(Color)<br />3<br /><br />>>> list(Color)<br />[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]<br /><br />Methods can be added to enumerations, and members can have their own<br />attributes -- see the documentation for details. (EXTERNAL, EXTERNAL_SHALLOW_CLONE, FOREIGN, MANAGED, MANAGED_SHALLOW_CLONE, MATERIALIZED_VIEW, METRIC_VIEW, STREAMING_TABLE, VIEW) |
updated_at | integer | Time at which this table was last modified, in epoch milliseconds. |
updated_by | string | Username of user who last modified the table. |
view_definition | string | View definition SQL (when __table_type__ is **VIEW**, **MATERIALIZED_VIEW**, or **STREAMING_TABLE**) |
view_dependencies | object | View dependencies (when table_type == **VIEW** or **MATERIALIZED_VIEW**, **STREAMING_TABLE**) - when DependencyList is None, the dependency is not provided; - when DependencyList is an empty list, the dependency is provided but is empty; - when DependencyList is not an empty list, dependencies are provided and recorded. Note: this field is not set in the output of the __listTables__ API. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | full_name, deployment_name | include_browse, include_delta_metadata, include_manifest_capabilities | Gets a table from the metastore for a specific catalog and schema. The caller must satisfy one of the |
list | select | catalog_name, schema_name, deployment_name | include_browse, include_manifest_capabilities, max_results, omit_columns, omit_properties, omit_username, page_token | Gets an array of all tables for the current metastore under the parent catalog and schema. The caller |
create | insert | deployment_name, name, catalog_name, schema_name, table_type, data_source_format, storage_location | Creates a new table in the specified catalog and schema. | |
update | update | full_name, deployment_name | Change the owner of the table. The caller must be the owner of the parent catalog, have the | |
delete | delete | full_name, deployment_name | Deletes a table from the specified parent catalog and schema. The caller must be the owner of the | |
exists | exec | full_name, deployment_name | Gets if a table exists in the metastore for a specific catalog and schema. The caller must satisfy one |
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 |
|---|---|---|
catalog_name | string | Name of parent catalog for tables of interest. |
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
full_name | string | Full name of the table. |
schema_name | string | Parent schema of tables. |
include_browse | boolean | Whether to include tables in the response for which the principal can only access selective metadata for. |
include_delta_metadata | boolean | Whether delta metadata should be included in the response. |
include_manifest_capabilities | boolean | Whether to include a manifest containing table capabilities in the response. |
max_results | integer | Maximum number of tables to return. If not set, all the tables are returned (not recommended). - when set to a value greater than 0, the page length is the minimum of this value and a server configured value; - when set to 0, the page length is set to a server configured value (recommended); - when set to a value less than 0, an invalid parameter error is returned; |
omit_columns | boolean | Whether to omit the columns of the table from the response or not. |
omit_properties | boolean | Whether to omit the properties of the table from the response or not. |
omit_username | boolean | Whether to omit the username of the table (e.g. owner, updated_by, created_by) from the response or not. |
page_token | string | Opaque token to send for the next page of results (pagination). |
SELECT examples
- get
- list
Gets a table from the metastore for a specific catalog and schema. The caller must satisfy one of the
SELECT
name,
data_access_configuration_id,
metastore_id,
pipeline_id,
table_id,
catalog_name,
full_name,
schema_name,
storage_credential_name,
access_point,
browse_only,
columns,
comment,
created_at,
created_by,
data_source_format,
deleted_at,
delta_runtime_properties_kvpairs,
effective_predictive_optimization_flag,
enable_predictive_optimization,
encryption_details,
owner,
properties,
row_filter,
securable_kind_manifest,
sql_path,
storage_location,
table_constraints,
table_type,
updated_at,
updated_by,
view_definition,
view_dependencies
FROM databricks_workspace.catalog.tables
WHERE full_name = '{{ full_name }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND include_browse = '{{ include_browse }}'
AND include_delta_metadata = '{{ include_delta_metadata }}'
AND include_manifest_capabilities = '{{ include_manifest_capabilities }}'
;
Gets an array of all tables for the current metastore under the parent catalog and schema. The caller
SELECT
name,
data_access_configuration_id,
metastore_id,
pipeline_id,
table_id,
catalog_name,
full_name,
schema_name,
storage_credential_name,
access_point,
browse_only,
columns,
comment,
created_at,
created_by,
data_source_format,
deleted_at,
delta_runtime_properties_kvpairs,
effective_predictive_optimization_flag,
enable_predictive_optimization,
encryption_details,
owner,
properties,
row_filter,
securable_kind_manifest,
sql_path,
storage_location,
table_constraints,
table_type,
updated_at,
updated_by,
view_definition,
view_dependencies
FROM databricks_workspace.catalog.tables
WHERE catalog_name = '{{ catalog_name }}' -- required
AND schema_name = '{{ schema_name }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND include_browse = '{{ include_browse }}'
AND include_manifest_capabilities = '{{ include_manifest_capabilities }}'
AND max_results = '{{ max_results }}'
AND omit_columns = '{{ omit_columns }}'
AND omit_properties = '{{ omit_properties }}'
AND omit_username = '{{ omit_username }}'
AND page_token = '{{ page_token }}'
;
INSERT examples
- create
- Manifest
Creates a new table in the specified catalog and schema.
INSERT INTO databricks_workspace.catalog.tables (
name,
catalog_name,
schema_name,
table_type,
data_source_format,
storage_location,
columns,
properties,
deployment_name
)
SELECT
'{{ name }}' /* required */,
'{{ catalog_name }}' /* required */,
'{{ schema_name }}' /* required */,
'{{ table_type }}' /* required */,
'{{ data_source_format }}' /* required */,
'{{ storage_location }}' /* required */,
'{{ columns }}',
'{{ properties }}',
'{{ deployment_name }}'
RETURNING
name,
data_access_configuration_id,
metastore_id,
pipeline_id,
table_id,
catalog_name,
full_name,
schema_name,
storage_credential_name,
access_point,
browse_only,
columns,
comment,
created_at,
created_by,
data_source_format,
deleted_at,
delta_runtime_properties_kvpairs,
effective_predictive_optimization_flag,
enable_predictive_optimization,
encryption_details,
owner,
properties,
row_filter,
securable_kind_manifest,
sql_path,
storage_location,
table_constraints,
table_type,
updated_at,
updated_by,
view_definition,
view_dependencies
;
# Description fields are for documentation purposes
- name: tables
props:
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the tables resource.
- name: name
value: "{{ name }}"
description: |
Name of table, relative to parent schema.
- name: catalog_name
value: "{{ catalog_name }}"
description: |
Name of parent catalog.
- name: schema_name
value: "{{ schema_name }}"
description: |
Name of parent schema relative to its parent catalog.
- name: table_type
value: "{{ table_type }}"
description: |
:param data_source_format: :class:`DataSourceFormat`
- name: data_source_format
value: "{{ data_source_format }}"
description: |
Data source format
- name: storage_location
value: "{{ storage_location }}"
description: |
Storage root URL for table (for **MANAGED**, **EXTERNAL** tables).
- name: columns
description: |
The array of __ColumnInfo__ definitions of the table's columns.
value:
- comment: "{{ comment }}"
mask:
function_name: "{{ function_name }}"
using_column_names:
- "{{ using_column_names }}"
name: "{{ name }}"
nullable: {{ nullable }}
partition_index: {{ partition_index }}
position: {{ position }}
type_interval_type: "{{ type_interval_type }}"
type_json: "{{ type_json }}"
type_name: "{{ type_name }}"
type_precision: {{ type_precision }}
type_scale: {{ type_scale }}
type_text: "{{ type_text }}"
- name: properties
value: "{{ properties }}"
description: |
A map of key-value properties attached to the securable.
UPDATE examples
- update
Change the owner of the table. The caller must be the owner of the parent catalog, have the
UPDATE databricks_workspace.catalog.tables
SET
owner = '{{ owner }}'
WHERE
full_name = '{{ full_name }}' --required
AND deployment_name = '{{ deployment_name }}' --required;
DELETE examples
- delete
Deletes a table from the specified parent catalog and schema. The caller must be the owner of the
DELETE FROM databricks_workspace.catalog.tables
WHERE full_name = '{{ full_name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;
Lifecycle Methods
- exists
Gets if a table exists in the metastore for a specific catalog and schema. The caller must satisfy one
EXEC databricks_workspace.catalog.tables.exists
@full_name='{{ full_name }}' --required,
@deployment_name='{{ deployment_name }}' --required
;