alterStageFileFormat

Modifies the file format configuration of an existing stage in Snowflake.

Note: This change type does not support automatic rollback.

Available attributes

Attribute

Type

Description

Required

catalogName

String

Name of the catalog (database) containing the stage

No

schemaName

String

Name of the schema containing the stage

No

stageName

String

Name of the stage to alter

Yes

ifExists

Boolean

Don't error if the stage doesn't exist

No

fileFormat

Nested

New file format configuration

Yes

fileFormat attributes

New file format configuration (nested element):

Attribute

Type

Description

fileFormatName

String

Reference to named file format

fileFormatType

String

Type: CSV, JSON, AVRO, ORC, PARQUET, XML, CUSTOM

formatTypeOptions

MapWrapper

Type-specific options (e.g., SKIP_HEADER, COMPRESSION)

<?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">
  <!-- Change file format type options -->
  <changeSet id="alter-stage-file-format" author="examples">
    <pro-snowflake:alterStageFileFormat stageName="DATA_STAGE">
      <pro-snowflake:fileFormat fileFormatType="CSV">
        <pro-snowflake:formatTypeOptions>
          <pro-snowflake:entry key="SKIP_HEADER" value="1"/>
          <pro-snowflake:entry key="COMPRESSION" value="AUTO"/>
        </pro-snowflake:formatTypeOptions>
      </pro-snowflake:fileFormat>
    </pro-snowflake:alterStageFileFormat>
  </changeSet>
  <!-- Change to a named file format -->
  <changeSet id="alter-stage-named-format" author="examples">
    <pro-snowflake:alterStageFileFormat stageName="DATA_STAGE" ifExists="true">
      <pro-snowflake:fileFormat fileFormatName="MY_CSV_FORMAT"/>
    </pro-snowflake:alterStageFileFormat>
  </changeSet>
  <!-- Change to JSON format -->
  <changeSet id="alter-stage-json-format" author="examples">
    <pro-snowflake:alterStageFileFormat stageName="DATA_STAGE">
      <pro-snowflake:fileFormat fileFormatType="JSON">
        <pro-snowflake:formatTypeOptions>
          <pro-snowflake:entry key="STRIP_OUTER_ARRAY" value="TRUE"/>
        </pro-snowflake:formatTypeOptions>
      </pro-snowflake:fileFormat>
    </pro-snowflake:alterStageFileFormat>
  </changeSet>
</databaseChangeLog>