snowflake.core.database.DatabaseResource

class snowflake.core.database.DatabaseResource(name: str, collection: DatabaseCollection)

Bases: ObjectReferenceMixin[DatabaseCollection]

Attributes

root
schemas

Methods

__init__(name: str, collection: DatabaseCollection) None
create_or_update(database: DatabaseModel) None

Create or update a database in Snowflake.

delete() None

Delete this Database.

disable_failover(accounts: List[str] | None = None) None

Disables failover for this primary databases.

Which means that no replica of this database (i.e. secondary database) can be promoted to serve as the primary database.

Optionally provide a comma-separated list of accounts in your organization to disable failover for this database only in the specified accounts.

disable_replication(accounts: List[str] | None = None) None

Disables replication for this primary database.

Which means that no replica of this database (i.e. secondary database) in another account can be refreshed. Any secondary databases remain linked to the primary database, but requests to refresh a secondary database are denied.

Note that disabling replication for a primary database does not prevent it from being replicated to the same account; therefore, the database continues to be listed in the SHOW REPLICATION DATABASES output.

Optionally provide a comma-separated list of accounts in your organization to disable replication for this database only in the specified accounts.

enable_failover(accounts: List[str]) None

Enable a list of replicas of this database that can be promoted to primary.

enable_replication(accounts: List[str], ignore_edition_check: bool = False) None

Promotes a local database to serve as a primary database for replication.

A primary database can be replicated in one or more accounts, allowing users in those accounts to query objects in each secondary (i.e. replica) database.

Alternatively, modify an existing primary database to add to or remove from the list of accounts that can store a replica of the database.

Provide a list of accounts in your organization that can store a replica of this database.

fetch() DatabaseModel
promote_to_primary_failover() None

Promotes the specified secondary (replica) database to serve as the primary.

When promoted, the database becomes writeable. At the same time, the previous primary database becomes a read-only secondary database.

refresh_replication() None

Refresh a secondary database from its primary database.

A snapshot includes changes to the objects and data.