snowflake.core.Identifier

class snowflake.core.Identifier(value: Identifier | IdentifierString | str)

Bases: object

Represents a Snowflake object identifier.

The original spelling is preserved, while equality and hashing follow Snowflake’s identifier rules. Unlike IdentifierString, instances representing the same Snowflake object compare equal.

Raises:
  • ValueError – If value is not a valid SQL identifier.

  • TypeError – If value is not an IdentifierLike.

Methods

classmethod from_canonical_name(name: CanonicalName) → Identifier

Build an Identifier that resolves to name.

Parameters:

name (CanonicalName) – Canonical (case-sensitive, unquoted) Snowflake object name.

Returns:

An identifier whose spelling resolves to name.

Return type:

Identifier

to_identifier_string() → IdentifierString

Return this identifier’s current spelling as an IdentifierString.

Unlike Identifier equality, the result compares character-for-character. Equivalent spellings of the same Snowflake object (for example foo, FOO, and "FOO") are distinct values.

Returns:

The current spelling as a plain str at runtime but with a distinct type for linting.

Return type:

IdentifierString

with_normalized_spelling() → Identifier

Return an Identifier whose spelling is a normalized form.

Normalized here means the spelling for two logically equivalent identifiers is the same. Identity is unchanged.

Returns:

An identifier with normalized spelling.

Return type:

Identifier

with_quoted_spelling() → Identifier

Return an Identifier whose spelling is quoted.

Unquoted identifiers are quoted with quote_name(). Already quoted identifiers keep their existing spelling. Identity is unchanged.

Returns:

An identifier whose original spelling is a double-quoted Snowflake identifier.

Return type:

Identifier