Skip to content

Sequence

You can provide configuration to Snowflake Object Lifecycle Engine for the following operations with sequence:

  • Manage the lifecycle of new and existing sequences
  • Manage the grants of a sequence

Usage

- sequence:
    name: <sequence-name>
    <configuration-key>: <value>
    database: rel(database.<database-name>)
    schema: rel(schema.<schema-name>)
    grants:
      <privilege>:
        - rel(role.<role-name>)
        - rel(role.<role-name>)
databases:
  <database-name>:
    schemas:
      <schema-name>:
        sequences:
          <sequence-name>:
            <configuration-key>: <value>
            grants:
              <privilege>:
                - <role-name>
                - <role-name>

Supported parameters

The engine supports the parameters listed below.

Configuration Key Required/Optional Data Types and Values Description
comment Optional String Specifies a comment for the sequence
deleted Optional Boolean: True enables deletion prevention, False does nothing Specifies what objects are allowed to be deleted
depends_on Optional List of String: See Object Dependencies for a definition of depends_on List of SOLE-managed objects that this sequence depends on. Objects defined in the list will be added to the generated HCL dependencies list to ensure proper creation order.
increment Optional Integer The amount the sequence will increase by each time it is used
grants Optional Map: See Supported Sequence Grants to Roles List of Privileges and Roles to which privileges are granted on the current sequence
manage_mode Optional String: all (default), none, grants Configures what properties to manage for the sequence.
See Changing Manage Mode before changing the value.
ordering Optional String: ORDER (default) The ordering of the sequence, which can be ORDER or NOORDER. The default is ORDER.
Note: If a sequence is set to NOORDER, you cannot change it back to ORDER.

Supported sequence grants to roles

Following are the privileges you can grant to roles in the sequence definition:

  • USAGE
  • OWNERSHIP

Examples

- sequence:
    name: SEQ_1
    database: rel(database.DATABASE_1)
    schema: rel(schema.SCHEMA_1)
    grants:
      USAGE:
        - ACCOUNTADMIN
        - rel(role.ROLE_1)
    comment: "Sequence 1"
    ordering: NOORDER
databases:
  DATABASE_1:
    comment: "Database one"
    schemas:
      SCHEMA_1:
        comment: "Schema one"
        sequences:
          SEQ_1:
            grants:
              USAGE:
                - ACCOUNTADMIN
                - ROLE_1
            comment: "Sequence 1"
            ordering: NOORDER