createSchema
Creates a new schema in Snowflake. Schemas are logical groupings of database objects (tables, views, stages, etc.) and provide namespace isolation.
Note: Automatic rollback drops the schema.
Known limitation: This change type does not support database inspection features (snapshot, diff, diff-changelog, and generate-changelog commands).
Available attributes
Attribute | Type | Description | Required |
|---|---|---|---|
| String | Name of the catalog (database) where the schema will be created | No |
| String | Name of the schema to create | Yes |
| Boolean | Replace the schema if it exists using | No |
| Boolean | Alter the schema if it exists using | No |
| Boolean | Only create if the schema doesn't exist using | No |
| Boolean | Create a transient schema (no Fail-safe period) | No |
| Boolean | Create managed access schema (only owner can grant privileges) | No |
| Integer | Number of days to retain data for Time Travel | No |
| Integer | Maximum number of days to extend data retention period | No |
| String | Default collation for tables/views created in this schema | No |
| String | Fully-qualified name of classification profile | No |
| String | Controls visibility of objects in INFORMATION_SCHEMA views | No |
| String | Log level: | No |
| String | Trace event level: | No |
| String | Comment describing the schema | No |
| Map | Key-value pairs of tags to apply (tags must exist)** | No |
| Map | Contact purposes and names (valid: | No |
* replaceIfExists, alterIfExists, and ifNotExists are mutually exclusive.
** tags and contacts are not supported with alterIfExists (CREATE OR ALTER).
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:pro-snowflake="http://www.liquibase.org/xml/ns/pro-snowflake"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/pro-snowflake
http://www.liquibase.org/xml/ns/pro-snowflake/liquibase-pro-snowflake-latest.xsd">
<!-- Basic schema creation -->
<changeSet id="create-basic-schema" author="examples">
<pro-snowflake:createSchema schemaName="ANALYTICS"/>
</changeSet>
<!-- Schema with IF NOT EXISTS -->
<changeSet id="create-schema-if-not-exists" author="examples">
<pro-snowflake:createSchema
schemaName="STAGING"
ifNotExists="true"
comment="Staging area for ETL"/>
</changeSet>
<!-- Full-featured schema with tags and contacts -->
<changeSet id="create-full-schema" author="examples">
<pro-snowflake:createSchema
schemaName="PRODUCTION_DATA"
isTransient="true"
withManagedAccess="true"
dataRetentionTimeInDays="1"
maxDataExtensionTimeInDays="14"
defaultDdlCollation="utf8"
logLevel="INFO"
traceLevel="ALWAYS"
comment="Production data schema">
<pro-snowflake:tags>
<pro-snowflake:entry key="environment" value="production"/>
<pro-snowflake:entry key="compliance" value="pci"/>
</pro-snowflake:tags>
<pro-snowflake:contacts>
<pro-snowflake:entry key="Steward" value="data_owner"/>
<pro-snowflake:entry key="Support" value="support_team"/>
</pro-snowflake:contacts>
</pro-snowflake:createSchema>
</changeSet>
</databaseChangeLog>