Schema

List schemas¶

GET/api/v2/databases/{database}/schemas
Lists the accessible schemas.

Path Parameters¶

ParameterDescription
database 
Identifier (i.e. name) for the database to which the resource belongs. You can use the `/api/v2/databases` GET request to get a list of available databases.

Query Parameters¶

ParameterDescription
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
Whether to include dropped schemas that have not yet been purged. Default: `false`.

Response¶

CodeDescription
200
Successful request.
202
Successfully accepted the request, but it is not completed yet.

Create a schema¶

POST/api/v2/databases/{database}/schemas
Creates a schema, with modifiers as query parameters. You must provide the full schema definition when creating a schema.

Query Parameters¶

ParameterDescription
createMode string
Query parameter allowing support for different modes of resource creation. Possible values include:
  • errorIfExists: Throws an error if you try to create a resource that already exists.
  • orReplace: Automatically replaces the existing resource with the current one.
  • ifNotExists: Creates a new resource when an alter is requested for a non-existent resource.
kind string
Type of schema to create. Currently, Snowflake supports only `transient` and `permanent` (also represented by the empty string).

Response¶

CodeDescription
200
Successful request.
202

Clone a schema¶

POST/api/v2/databases/{database}/schemas/{name}:clone
Clones an existing schema, with modifiers as query parameters. You must provide the full schema definition when cloning an existing schema.

Query Parameters¶

ParameterDescription
kind string
Type of schema to clone. Currently, Snowflake supports only `transient` and `permanent` (also represented by the empty string).
targetDatabase string
Database of the newly created schema. Defaults to the source schema's database.

Response¶

CodeDescription
200
202

Undrop a schema¶

POST/api/v2/databases/{database}/schemas/{name}:undrop
Undrops schema.

Response¶

CodeDescription
200
202

Fetches a schema¶

GET/api/v2/databases/{database}/schemas/{name}
Fetches a schema.

Path Parameters¶

ParameterDescription
name 
Identifier (i.e. name) for the resource.

Response¶

CodeDescription
200
successful
202

Create a new, or alters an existing, schema¶

PUT/api/v2/databases/{database}/schemas/{name}
Creates a new, or alters an existing, schema. You must provide the full schema definition even when altering an existing schema.

Query Parameters¶

ParameterDescription
kind string
Type of schema to create. Currently, Snowflake supports only `transient` and `permanent` (also represented by the empty string).

Response¶

CodeDescription
200
202

Delete a schema¶

DELETE/api/v2/databases/{database}/schemas/{name}
Deletes the specified schema. If you enable the `ifExists` parameter, the operation succeeds even if the schema does not exist. Otherwise, a 404 failure is returned if the schema does not exist. if the drop is unsuccessful.

Query Parameters¶

ParameterDescription
ifExists boolean
Query parameter that specifies how to handle the request for a resource that does not exist:
  • true: The endpoint does not throw an error if the resource does not exist. It returns a 200 success response, but does not take any action on the resource.
  • false: The endpoint throws an error if the resource doesn't exist.
restrict boolean
Whether to drop the schema if foreign keys exist that reference any tables in the schema.
  • true: Return a warning about existing foreign key references and don't drop the schema.
  • false: Drop the schema and all objects in the database, including tables with primary or unique keys that are referenced by foreign keys in other tables.
Default: `false`.
  • true: Return a warning about existing foreign key references and don't drop the schema.
  • false: Drop the schema and all objects in the database, including tables with primary or unique keys that are referenced by foreign keys in other tables.

Response¶

CodeDescription
200
202