createFileFormat
Creates a new file format in Snowflake. File formats define how data files should be parsed when loading or unloading data.
Note: Automatic rollback drops the file format.
Available attributes
Attribute | Type | Description | Required |
|---|---|---|---|
| String | Name of the catalog (database) where the file format will be created | No |
| String | Name of the schema where the file format will be created | No |
| String | Name of the file format to create | Yes |
| String | Type: | No |
| String | Comment describing the file format | No |
| Boolean | Replace the file format if it already exists using | No |
| Boolean | Alter the file format if it already exists using | No |
| Boolean | Only create if the file format doesn't exist using | No |
| Boolean | Create a temporary file format | No |
* replaceIfExists, alterIfExists, and ifNotExists are mutually exclusive
formatTypeOptions attributes
Attribute | Type | Description | Required |
|---|---|---|---|
| String | Format-specific option name (e.g., | Yes |
| String | Option value | Yes |
<?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">
<!-- Create CSV file format with options -->
<changeSet id="create-file-format-csv" author="examples">
<pro-snowflake:createFileFormat
fileFormatName="CSV_FORMAT"
fileFormatType="CSV"
ifNotExists="true"
comment="CSV file format for data imports">
<pro-snowflake:formatTypeOptions>
<pro-snowflake:entry key="COMPRESSION" value="ZSTD"/>
<pro-snowflake:entry key="FIELD_DELIMITER" value=","/>
<pro-snowflake:entry key="SKIP_HEADER" value="1"/>
</pro-snowflake:formatTypeOptions>
</pro-snowflake:createFileFormat>
</changeSet>
<!-- Create JSON file format -->
<changeSet id="create-file-format-json" author="examples">
<pro-snowflake:createFileFormat
fileFormatName="JSON_FORMAT"
fileFormatType="JSON"
replaceIfExists="true"
comment="JSON file format">
<pro-snowflake:formatTypeOptions>
<pro-snowflake:entry key="COMPRESSION" value="AUTO"/>
<pro-snowflake:entry key="STRIP_OUTER_ARRAY" value="TRUE"/>
</pro-snowflake:formatTypeOptions>
</pro-snowflake:createFileFormat>
</changeSet>
<!-- Create temporary Parquet file format -->
<changeSet id="create-file-format-parquet" author="examples">
<pro-snowflake:createFileFormat
fileFormatName="TEMP_PARQUET_FORMAT"
fileFormatType="PARQUET"
temporary="true"/>
</changeSet>
<!-- Create or alter file format -->
<changeSet id="create-file-format-alter-if-exists" author="examples">
<pro-snowflake:createFileFormat
fileFormatName="AVRO_FORMAT"
fileFormatType="AVRO"
alterIfExists="true"
comment="AVRO format - creates or alters if exists"/>
</changeSet>
</databaseChangeLog>