snowflake.core.database.DatabaseCollection

class snowflake.core.database.DatabaseCollection(root: Root)

Bases: AccountObjectCollectionParent[DatabaseResource]

Attributes

root

Methods

__init__(root: Root) None
create(database: DatabaseModel, *, clone: str | CloneModel | None = None, mode: CreateMode = CreateMode.error_if_exists, kind: str = '') DatabaseResource

Create a database in Snowflake.

Parameters:
  • database – An instance of Database, the definition of database we should create.

  • clone – Whether to clone an existing database. An instance of Clone, or None if no cloning is necessary.

  • mode

    One of the following strings.

    CreateMode.error_if_exists: Throw an snowflake.core.exceptions.ConflictError if the database already exists in Snowflake. Equivalent to SQL create database <name> ....

    CreateMode.or_replace: Replace if the database already exists in Snowflake. Equivalent to SQL create or replace database <name> ....

    CreateMode.if_not_exists: Do nothing if the database already exists in Snowflake. Equivalent to SQL create database <name> if not exists...

    Default value is CreateMode.error_if_exists.

  • kind – The kind of database to create. At the time of writing we support regular (represented by the empty string) and transient databases (represented by transient).

items() ItemsView[str, T]
iter(*, like: str | None = None, starts_with: str | None = None, limit: int | None = None, from_name: str | None = None) PagedIter[DatabaseModel]

Look up databases in Snowflake.

keys() KeysView[str]
values() ValuesView[T]