Database
Lists databases¶
GET/api/v2/databases
Lists the accessible databases.
Query Parameters¶
Parameter | Description |
---|---|
like string | Query parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters. |
startsWith string | Query parameter to filter the command output based on the string of characters that appear at the beginning of the object name. Uses case-sensitive pattern matching. |
showLimit integer | Query parameter to limit the maximum number of rows returned by a command. |
fromName string | Query parameter to enable fetching rows only following the first row whose object name matches the specified string. Case-sensitive and does not have to be the full name. |
history boolean | Optionally includes dropped databases that have not yet been purged. |
Response¶
Code | Description |
---|---|
200 | Successful request. |
202 | Successfully accepted the request, but it is not completed yet. |
Creates a database¶
POST/api/v2/databases
Creates a database, with modifiers as query parameters. You must provide the full database definition when creating a database.
Query Parameters¶
Parameter | Description |
---|---|
createMode string | Query parameter allowing support for different modes of resource creation. Possible values include:
|
kind string | Type of database to create. Currently, Snowflake supports only `transient` and `permanent` (also represented by the empty string). |
Response¶
Code | Description |
---|---|
200 | Successful request. |
202 |
Clones a database¶
POST/api/v2/databases/{name}:clone
Clones an existing database, with modifiers as query parameters. You must provide the full database definition when cloning an existing database.
Query Parameters¶
Parameter | Description |
---|---|
kind string | Type of database to create. Currently, Snowflake supports only `transient` and `permanent` (also represented by the empty string). |
Response¶
Code | Description |
---|---|
200 | |
202 |
Fetches a database¶
Creates a new, or alters an existing, database¶
PUT/api/v2/databases/{name}
Creates a new, or alters an existing, database. You must provide the full database definition even when altering an existing database.
Response¶
Code | Description |
---|---|
200 | |
202 |
Deletes a database¶
DELETE/api/v2/databases/{name}
Deletes the specified database. If you enable the `ifExists` parameter, the operation succeeds even if the database does not exist. Otherwise, a 404 failure is returned if the database does not exist. if the drop is unsuccessful.
Query Parameters¶
Parameter | Description |
---|---|
ifExists boolean | Query parameter that specifies how to handle the request for a resource that does not exist:
|
restrict boolean | Whether to drop the database if foreign keys exist that reference any tables in the database.
|
Response¶
Code | Description |
---|---|
200 | |
202 |
Undrop a database¶
Enables database replication¶
POST/api/v2/databases/{name}/replication:enable
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.
Query Parameters¶
Parameter | Description |
---|---|
ignore_edition_check boolean | Whether to allow replicating data to accounts on lower editions. Default: `true`.
For more information, see the <a href=https://docs.snowflake.com/en/sql-reference/sql/alter-database> ALTER DATABASE</a> reference. |
Response¶
Code | Description |
---|---|
200 | |
202 |
Disables database replication¶
POST/api/v2/databases/{name}/replication:disable
Disables replication for this primary database, meaning 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.
Response¶
Code | Description |
---|---|
200 | |
202 |
Refreshes database replications¶
POST/api/v2/databases/{name}/replication:refresh
Refreshes a secondary database from a snapshot of its primary database. A snapshot includes changes to the objects and data.
If you call this endpoint while another refresh for the same replica database is running, it fails and returns an error. Snowflake ensures only one refresh is executed at any given time.
Response¶
Code | Description |
---|---|
200 | |
202 |
Enables database failover¶
POST/api/v2/databases/{name}/failover:enable
Specifies a comma-separated list of accounts in your organization where a replica of this primary database can be promoted to serve as the primary database.
Response¶
Code | Description |
---|---|
200 | |
202 |
Disables database failover¶
POST/api/v2/databases/{name}/failover:disable
Disables failover for this primary database, meaning no replica of this database (i.e. secondary database) can be promoted to serve as the primary database.
Response¶
Code | Description |
---|---|
200 | |
202 |
Sets a primary database¶
POST/api/v2/databases/{name}/failover:primary
Promotes the specified secondary (replica) database to serve as the primary database. When promoted, the database becomes writeable. At the same time, the previous primary database becomes a read-only secondary database.
Response¶
Code | Description |
---|---|
200 | |
202 |