Skip to main content

schemas

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

Overview

Nameschemas
TypeResource
Iddatabricks_workspace.unitycatalog.schemas

Fields

The following fields are returned by SELECT queries:

The schema was successfully retrieved.

NameDatatypeDescription
namestring
metastore_idstring
schema_idstring
catalog_namestring
full_namestring
browse_onlyboolean
catalog_typestring
commentstring
created_atinteger
created_bystring
effective_predictive_optimization_flagobject
enable_predictive_optimizationstring
ownerstring
propertiesobject
storage_locationstring
storage_rootstring
updated_atinteger
updated_bystring

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectdeployment_nameGets the specified schema within the metastore. The caller must be a metastore admin, the owner of the schema, or a user that has the
listselectdeployment_nameGets an array of schemas for a catalog in the metastore. If the caller is the metastore admin or the owner of the parent catalog, all schemas for the catalog will be retrieved. Otherwise, only schemas owned by the caller (or for which the caller has the
createinsertdeployment_nameCreates a new schema for catalog in the Metatastore. The caller must be a metastore admin, or have the
updateupdatedeployment_nameUpdates a schema for a catalog. The caller must be the owner of the schema or a metastore admin. If the caller is a metastore admin, only the
deletedeletedeployment_nameDeletes the specified schema from the parent catalog. The caller must be the owner of the schema or an owner of the parent catalog.

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
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)

SELECT examples

Gets the specified schema within the metastore. The caller must be a metastore admin, the owner of the schema, or a user that has 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.unitycatalog.schemas
WHERE deployment_name = '{{ deployment_name }}' -- required;

INSERT examples

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

INSERT INTO databricks_workspace.unitycatalog.schemas (
data__name,
data__catalog_name,
data__comment,
data__storage_root,
data__properties,
deployment_name
)
SELECT
'{{ name }}',
'{{ catalog_name }}',
'{{ comment }}',
'{{ storage_root }}',
'{{ properties }}',
'{{ 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 the caller is a metastore admin, only the

UPDATE databricks_workspace.unitycatalog.schemas
SET
data__owner = '{{ owner }}',
data__comment = '{{ comment }}',
data__enable_predictive_optimization = '{{ enable_predictive_optimization }}',
data__new_name = '{{ new_name }}',
data__properties = '{{ properties }}'
WHERE
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 owner of the parent catalog.

DELETE FROM databricks_workspace.unitycatalog.schemas
WHERE deployment_name = '{{ deployment_name }}' --required;