Skip to main content

tables

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

Overview

Nametables
TypeResource
Iddatabricks_workspace.catalog.tables

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringName of table, relative to parent schema.
data_access_configuration_idstringUnique ID of the Data Access Configuration to use with the table data.
metastore_idstringUnique identifier of parent metastore.
pipeline_idstringThe pipeline ID of the table. Applicable for tables created by pipelines (Materialized View, Streaming Table, etc.).
table_idstringThe unique identifier of the table.
catalog_namestringName of parent catalog.
full_namestringFull name of table, in form of __catalog_name__.__schema_name__.__table_name__
schema_namestringName of parent schema relative to its parent catalog.
storage_credential_namestringName of the storage credential, when a storage credential is configured for use with this table.
access_pointstring
browse_onlybooleanIndicates whether the principal is limited to retrieving metadata for the associated object through the BROWSE privilege when include_browse is enabled in the request.
columnsarrayThe array of __ColumnInfo__ definitions of the table's columns.
commentstringUser-provided free-form text description.
created_atintegerTime at which this table was created, in epoch milliseconds.
created_bystringUsername of table creator.
data_source_formatstringData 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_atintegerTime at which this table was deleted, in epoch milliseconds. Field is omitted if table is not deleted.
delta_runtime_properties_kvpairsobjectInformation pertaining to current state of the delta table.
effective_predictive_optimization_flagobject
enable_predictive_optimizationstringCreate a collection of name/value pairs.<br /><br />Example enumeration:<br /><br />&gt;&gt;&gt; class Color(Enum):<br />... RED = 1<br />... BLUE = 2<br />... GREEN = 3<br /><br />Access them by:<br /><br />- attribute access::<br /><br />&gt;&gt;&gt; Color.RED<br />&lt;Color.RED: 1&gt;<br /><br />- value lookup:<br /><br />&gt;&gt;&gt; Color(1)<br />&lt;Color.RED: 1&gt;<br /><br />- name lookup:<br /><br />&gt;&gt;&gt; Color['RED']<br />&lt;Color.RED: 1&gt;<br /><br />Enumerations can be iterated over, and know how many members they have:<br /><br />&gt;&gt;&gt; len(Color)<br />3<br /><br />&gt;&gt;&gt; list(Color)<br />[&lt;Color.RED: 1&gt;, &lt;Color.BLUE: 2&gt;, &lt;Color.GREEN: 3&gt;]<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_detailsobjectEncryption options that apply to clients connecting to cloud storage.
ownerstringUsername of current owner of table.
propertiesobjectA map of key-value properties attached to the securable.
row_filterobject
securable_kind_manifestobjectSecurableKindManifest of table, including capabilities the table has.
sql_pathstringList of schemes whose objects can be referenced without qualification.
storage_locationstringStorage root URL for table (for **MANAGED**, **EXTERNAL** tables).
table_constraintsarrayList of table constraints. Note: this field is not set in the output of the __listTables__ API.
table_typestringCreate a collection of name/value pairs.<br /><br />Example enumeration:<br /><br />&gt;&gt;&gt; class Color(Enum):<br />... RED = 1<br />... BLUE = 2<br />... GREEN = 3<br /><br />Access them by:<br /><br />- attribute access::<br /><br />&gt;&gt;&gt; Color.RED<br />&lt;Color.RED: 1&gt;<br /><br />- value lookup:<br /><br />&gt;&gt;&gt; Color(1)<br />&lt;Color.RED: 1&gt;<br /><br />- name lookup:<br /><br />&gt;&gt;&gt; Color['RED']<br />&lt;Color.RED: 1&gt;<br /><br />Enumerations can be iterated over, and know how many members they have:<br /><br />&gt;&gt;&gt; len(Color)<br />3<br /><br />&gt;&gt;&gt; list(Color)<br />[&lt;Color.RED: 1&gt;, &lt;Color.BLUE: 2&gt;, &lt;Color.GREEN: 3&gt;]<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_atintegerTime at which this table was last modified, in epoch milliseconds.
updated_bystringUsername of user who last modified the table.
view_definitionstringView definition SQL (when __table_type__ is **VIEW**, **MATERIALIZED_VIEW**, or **STREAMING_TABLE**)
view_dependenciesobjectView 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:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfull_name, deployment_nameinclude_browse, include_delta_metadata, include_manifest_capabilitiesGets a table from the metastore for a specific catalog and schema. The caller must satisfy one of the
listselectcatalog_name, schema_name, deployment_nameinclude_browse, include_manifest_capabilities, max_results, omit_columns, omit_properties, omit_username, page_tokenGets an array of all tables for the current metastore under the parent catalog and schema. The caller
createinsertdeployment_name, name, catalog_name, schema_name, table_type, data_source_format, storage_locationCreates a new table in the specified catalog and schema.
updateupdatefull_name, deployment_nameChange the owner of the table. The caller must be the owner of the parent catalog, have the
deletedeletefull_name, deployment_nameDeletes a table from the specified parent catalog and schema. The caller must be the owner of the
existsexecfull_name, deployment_nameGets 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.

NameDatatypeDescription
catalog_namestringName of parent catalog for tables of interest.
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
full_namestringFull name of the table.
schema_namestringParent schema of tables.
include_browsebooleanWhether to include tables in the response for which the principal can only access selective metadata for.
include_delta_metadatabooleanWhether delta metadata should be included in the response.
include_manifest_capabilitiesbooleanWhether to include a manifest containing table capabilities in the response.
max_resultsintegerMaximum 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_columnsbooleanWhether to omit the columns of the table from the response or not.
omit_propertiesbooleanWhether to omit the properties of the table from the response or not.
omit_usernamebooleanWhether to omit the username of the table (e.g. owner, updated_by, created_by) from the response or not.
page_tokenstringOpaque token to send for the next page of results (pagination).

SELECT examples

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 }}'
;

INSERT examples

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
;

UPDATE examples

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

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

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
;