Skip to main content

schemas

Operations on a schemas resource.

Overview

Nameschemas
TypeResource
Iddatabricks_workspace.unitycatalog.schemas

Fields

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

Methods

NameAccessible byRequired ParamsDescription
getSELECTfull_name, deployment_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
listSELECTcatalog_name, deployment_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
deleteDELETEfull_name, deployment_nameDeletes the specified schema from the parent catalog. The caller must be the owner of the schema or an owner of the parent catalog.
updateUPDATEfull_name, deployment_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

SELECT examples

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

INSERT example

Use the following StackQL query and manifest file to create a new schemas resource.

/*+ create */
INSERT INTO databricks_workspace.unitycatalog.schemas (
deployment_name,
data__name,
data__catalog_name,
data__comment,
data__properties,
data__storage_root
)
SELECT
'{{ deployment_name }}',
'{{ name }}',
'{{ catalog_name }}',
'{{ comment }}',
'{{ properties }}',
'{{ storage_root }}'
;

UPDATE example

Updates a schemas resource.

/*+ update */
-- replace field1, field2, etc. with the fields you want to update
UPDATE databricks_workspace.unitycatalog.schemas
SET field1 = '{{ value1 }}',
field2 = '{{ value2 }}', ...
WHERE full_name = '{{ full_name }}' AND
deployment_name = '{{ deployment_name }}';

DELETE example

Deletes a schemas resource.

/*+ delete */
DELETE FROM databricks_workspace.unitycatalog.schemas
WHERE full_name = '{{ full_name }}' AND
deployment_name = '{{ deployment_name }}';