snowflake.core.QualifiedIdentifier¶
- class snowflake.core.QualifiedIdentifier(name: Identifier | IdentifierString | str, schema: Identifier | IdentifierString | str | None = None, database: Identifier | IdentifierString | str | None = None)¶
Bases:
objectRepresents a Snowflake object identifier with optional schema and database qualifiers.
Components are
Identifierinstances, so equality and hashing follow Snowflake’s identifier rules. The name may be unqualified, schema-qualified, or database-qualified. When a database is set without a schema, the SQL form uses double-dot notation (database..name).- Parameters:
name (IdentifierLike) – Object name identifier.
schema (IdentifierLike or None, optional) – Schema qualifier, if any.
database (IdentifierLike or None, optional) – Database qualifier, if any.
- Raises:
ValueError – If any provided component is not a valid SQL identifier.
TypeError – If any provided component is not an
IdentifierLike.
Examples
Attributes
- database¶
- name¶
Methods
- classmethod from_string(raw_qualified_identifier: str) QualifiedIdentifier¶
Parse
[[database.]schema.]nameordatabase..nameinto aQualifiedIdentifier.- Parameters:
raw_qualified_identifier (str) – Object name in the form
name,schema.name,database.schema.name, ordatabase..name. Callables with signature suffixes are not accepted.- Returns:
Parsed qualified identifier.
- Return type:
- Raises:
InvalidIdentifierError – If identifier does not meet identifier requirements.
- to_dict() dict[str, str | None]¶
Return the dictionary representation of the instance.
- Returns:
Mapping with keys
name,schema, anddatabase.- Return type:
dict of str to str or None
- using_connection(conn: SnowflakeConnection) QualifiedIdentifier¶
Return a copy filled in with database and schema from conn when unset.
- Parameters:
conn (SnowflakeConnection) – Connection whose current database and schema may supply missing qualifiers.
- Returns:
A new instance with qualifiers taken from conn where this instance had none.
- Return type:
- with_database(database: Identifier | IdentifierString | str | None) QualifiedIdentifier¶
Return a copy with database replaced.
- Parameters:
database (IdentifierLike or None) – New database qualifier, or
Noneto clear it.- Returns:
A new instance with the updated database.
- Return type:
- with_name(name: Identifier | IdentifierString | str) QualifiedIdentifier¶
Return a copy with name replaced.
- Parameters:
name (IdentifierLike) – New object name identifier.
- Returns:
A new instance with the updated name.
- Return type:
- with_normalized_spelling() QualifiedIdentifier¶
Return a copy whose components use normalized spellings.
- Returns:
A new instance with normalized component spellings. Identity is unchanged.
- Return type:
- with_quoted_spelling() QualifiedIdentifier¶
Return a copy whose components use quoted spellings.
- Returns:
A new instance with quoted component spellings. Identity is unchanged.
- Return type:
- with_schema(schema: Identifier | IdentifierString | str | None) QualifiedIdentifier¶
Return a copy with schema replaced.
- Parameters:
schema (IdentifierLike or None) – New schema qualifier, or
Noneto clear it.- Returns:
A new instance with the updated schema.
- Return type: