Skip to main content

schemas

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

Overview

Nameschemas
TypeResource
Iddatabricks_workspace.catalog.schemas

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringName of schema, relative to parent catalog.
metastore_idstringUnique identifier of parent metastore.
schema_idstringThe unique identifier of the schema.
catalog_namestringName of parent catalog.
full_namestringFull name of schema, in form of __catalog_name__.__schema_name__.
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.
catalog_typestringThe type of the catalog. (DELTASHARING_CATALOG, FOREIGN_CATALOG, INTERNAL_CATALOG, MANAGED_CATALOG, MANAGED_ONLINE_CATALOG, SYSTEM_CATALOG)
commentstringUser-provided free-form text description.
created_atintegerTime at which this schema was created, in epoch milliseconds.
created_bystringUsername of schema creator.
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)
ownerstringUsername of current owner of schema.
propertiesobjectA map of key-value properties attached to the securable.
storage_locationstringStorage location for managed tables within schema.
storage_rootstringStorage root URL for managed tables within schema.
updated_atintegerTime at which this schema was created, in epoch milliseconds.
updated_bystringUsername of user who last modified schema.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfull_name, deployment_nameinclude_browseGets the specified schema within the metastore. The caller must be a metastore admin, the owner of the
listselectcatalog_name, deployment_nameinclude_browse, max_results, page_tokenGets an array of schemas for a catalog in the metastore. If the caller is the metastore admin or the
createinsertdeployment_name, name, catalog_nameCreates a new schema for catalog in the Metastore. The caller must be a metastore admin, or have the
updateupdatefull_name, deployment_nameUpdates a schema for a catalog. The caller must be the owner of the schema or a metastore admin. If
deletedeletefull_name, deployment_nameforceDeletes the specified schema from the parent catalog. The caller must be the owner of the schema or an

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_namestringParent catalog for schemas of interest.
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
full_namestringFull name of the schema.
forcebooleanForce deletion even if the schema is not empty.
include_browsebooleanWhether to include schemas in the response for which the principal can only access selective metadata for
max_resultsintegerMaximum number of schemas to return. If not set, all the schemas 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;
page_tokenstringOpaque pagination token to go to next page based on previous query.

SELECT examples

Gets the specified schema within the metastore. The caller must be a metastore admin, the owner of the

SELECT
name,
metastore_id,
schema_id,
catalog_name,
full_name,
browse_only,
catalog_type,
comment,
created_at,
created_by,
effective_predictive_optimization_flag,
enable_predictive_optimization,
owner,
properties,
storage_location,
storage_root,
updated_at,
updated_by
FROM databricks_workspace.catalog.schemas
WHERE full_name = '{{ full_name }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND include_browse = '{{ include_browse }}'
;

INSERT examples

Creates a new schema for catalog in the Metastore. The caller must be a metastore admin, or have the

INSERT INTO databricks_workspace.catalog.schemas (
name,
catalog_name,
comment,
properties,
storage_root,
deployment_name
)
SELECT
'{{ name }}' /* required */,
'{{ catalog_name }}' /* required */,
'{{ comment }}',
'{{ properties }}',
'{{ storage_root }}',
'{{ deployment_name }}'
RETURNING
name,
metastore_id,
schema_id,
catalog_name,
full_name,
browse_only,
catalog_type,
comment,
created_at,
created_by,
effective_predictive_optimization_flag,
enable_predictive_optimization,
owner,
properties,
storage_location,
storage_root,
updated_at,
updated_by
;

UPDATE examples

Updates a schema for a catalog. The caller must be the owner of the schema or a metastore admin. If

UPDATE databricks_workspace.catalog.schemas
SET
comment = '{{ comment }}',
enable_predictive_optimization = '{{ enable_predictive_optimization }}',
new_name = '{{ new_name }}',
owner = '{{ owner }}',
properties = '{{ properties }}'
WHERE
full_name = '{{ full_name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
RETURNING
name,
metastore_id,
schema_id,
catalog_name,
full_name,
browse_only,
catalog_type,
comment,
created_at,
created_by,
effective_predictive_optimization_flag,
enable_predictive_optimization,
owner,
properties,
storage_location,
storage_root,
updated_at,
updated_by;

DELETE examples

Deletes the specified schema from the parent catalog. The caller must be the owner of the schema or an

DELETE FROM databricks_workspace.catalog.schemas
WHERE full_name = '{{ full_name }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND force = '{{ force }}'
;