snowflake.core.sequence.SequenceResource¶

class snowflake.core.sequence.SequenceResource(name: str, collection_class: SequenceCollectionBase)¶

Bases: SequenceResourceBase

Represents a reference to a Snowflake sequence.

With this sequence reference, you can fetch information about a sequence, as well as perform certain actions on it.

Attributes

database¶

The DatabaseResource this reference belongs to.

fully_qualified_name¶

Return the fully qualified name of the object this reference points to.

root¶

The Root object this reference belongs to.

Methods

clone(sequence: Sequence, create_mode: CreateMode | str | None = None, target_database: str | None = None, target_schema: str | None = None) → None¶

Create a new sequence by cloning from the specified resource.

Parameters:
  • sequence (Sequence) – (required)

  • create_mode (Union[CreateMode, str]) – Parameter allowing support for different modes of resource creation. Possible values include: - errorIfExists: Throws an error if you try to create a resource that already exists. - orReplace: Automatically replaces the existing resource with the current one. - ifNotExists: Creates a new resource when an alter is requested for a non-existent resource.

  • target_database (str) – Database of the target resource. Defaults to the source’s database

  • target_schema (str) – Schema of the target resource. Defaults to the source’s schema

clone_async(sequence: Sequence, create_mode: CreateMode | str | None = None, target_database: str | None = None, target_schema: str | None = None) → PollingOperation[None]¶

An asynchronous version of clone().

Refer to PollingOperation for more information on asynchronous execution and the return type.

drop(if_exists: bool | None = None) → None¶

Delete a sequence.

Parameters:

if_exists (bool) – Parameter that specifies how to handle the request for a resource that does not exist: - true: The endpoint does not throw an error if the resource does not exist. It returns a 200 success response, but does not take any action on the resource. - false: The endpoint throws an error if the resource doesn’t exist.

drop_async(if_exists: bool | None = None) → PollingOperation[None]¶

An asynchronous version of drop().

Refer to PollingOperation for more information on asynchronous execution and the return type.

fetch() → Sequence¶

Fetch a sequence.

fetch_async() → PollingOperation[Sequence]¶

An asynchronous version of fetch().

Refer to PollingOperation for more information on asynchronous execution and the return type.

rename(target_name: str, if_exists: bool | None = None, target_database: str | None = None, target_schema: str | None = None) → None¶

Rename a sequence with a new identifier.

Parameters:
  • target_name (str) – Name of the target resource. (required)

  • if_exists (bool) – Parameter that specifies how to handle the request for a resource that does not exist: - true: The endpoint does not throw an error if the resource does not exist. It returns a 200 success response, but does not take any action on the resource. - false: The endpoint throws an error if the resource doesn’t exist.

  • target_database (str) – Database of the target resource. Defaults to the source’s database

  • target_schema (str) – Schema of the target resource. Defaults to the source’s schema

rename_async(target_name: str, if_exists: bool | None = None, target_database: str | None = None, target_schema: str | None = None) → PollingOperation[None]¶

An asynchronous version of rename().

Refer to PollingOperation for more information on asynchronous execution and the return type.