snowflake.core.CanonicalName

class snowflake.core.CanonicalName(value: str)

Bases: object

Canonical name of an object in Snowflake.

A canonical name is the actual name of an object, case-sensitive and unquoted.

Methods

classmethod resolve_from_identifier(identifier: Identifier | IdentifierString | str) → CanonicalName

Resolve an identifier spelling to the canonical name Snowflake would store.

See https://docs.snowflake.com/en/sql-reference/identifiers-syntax#label-identifier-casing for the resolution rules. Construction of Identifier performs the validation.

Parameters:

identifier (IdentifierLike) – Identifier spelling or Identifier instance.

Returns:

Canonical (case-sensitive, unquoted) name for the identifier.

Return type:

CanonicalName

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

  • TypeError – If identifier is not an IdentifierLike.

to_identifier_string() → IdentifierString

Produce an identifier string which would resolve to this canonical name.

Returns:

An identifier string that resolves to this canonical name. It is possible that many different identifier strings could resolve to this canonical name.

Return type:

IdentifierString