Skip to content
Talk to an Engineer Dashboard

Snowflake

Connect to Snowflake to manage and analyze your data warehouse workloads

Connect to Snowflake to manage and analyze your data warehouse workloads

Snowflake logo

Supports authentication: OAuth 2.0

Register your Scalekit environment with the Snowflake connector so Scalekit handles the authentication flow and token lifecycle for you. The connection name you create will be used to identify and invoke the connection programmatically. You’ll need to create an OAuth Security Integration in your Snowflake account.

  1. Set up auth redirects

    • In Scalekit dashboard, go to Agent Auth → Create Connection.

    • Find Snowflake from the list of providers and click Create.

    • Copy the redirect URI. It looks like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback.

      Configure Snowflake Connection with redirect URI
    • Log into your Snowflake account (Snowsight) and run the following SQL to create an OAuth Security Integration, replacing <redirect_uri> with the URI you copied:

      CREATE OR REPLACE SECURITY INTEGRATION scalekit_oauth
      TYPE = OAUTH
      OAUTH_CLIENT = CUSTOM
      OAUTH_CLIENT_TYPE = 'CONFIDENTIAL'
      OAUTH_REDIRECT_URI = '<redirect_uri>'
      ENABLED = TRUE;
  2. Get client credentials

    After creating the integration, run the following SQL to retrieve the client credentials:

    SELECT SYSTEM$SHOW_OAUTH_CLIENT_SECRETS('SCALEKIT_OAUTH');

    This returns a JSON object containing:

    • Client ID — value of OAUTH_CLIENT_ID
    • Client Secret — value of OAUTH_CLIENT_SECRET_2 (or OAUTH_CLIENT_SECRET_1)
  3. Add credentials in Scalekit

    • In Scalekit dashboard, go to Agent Auth → Connections and open the connection you created.

    • Enter your credentials:

      • Client ID (from the SQL output)
      • Client Secret (from the SQL output)
      Adding credentials for Snowflake in Scalekit dashboard
    • Click Save.

Connect a user’s Snowflake account and make API calls on their behalf — Scalekit handles OAuth and token management automatically.

import scalekit.client, os
from dotenv import load_dotenv
load_dotenv()
connection_name = "snowflake" # get your connection name from connection configurations
identifier = "user_123" # your unique user identifier
# Get your credentials from app.scalekit.com → Developers → Settings → API Credentials
scalekit_client = scalekit.client.ScalekitClient(
client_id=os.getenv("SCALEKIT_CLIENT_ID"),
client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),
env_url=os.getenv("SCALEKIT_ENV_URL"),
)
actions = scalekit_client.actions
# Authenticate the user
link_response = actions.get_authorization_link(
connection_name=connection_name,
identifier=identifier
)
# present this link to your user for authorization, or click it yourself for testing
print("đź”— Authorize Snowflake:", link_response.link)
input("Press Enter after authorizing...")
# Make a request via Scalekit proxy
result = actions.request(
connection_name=connection_name,
identifier=identifier,
path="/api/v2/statements",
method="POST"
)
print(result)

Execute one or more SQL statements against Snowflake using the SQL API.

NameTypeRequiredDescription
statementstringYesSQL statement to execute
asyncboolean | nullNoExecute statement asynchronously and return a statement handle
bindingsobject | nullNoBind variables object for ? placeholders in the SQL statement
databasestring | nullNoDatabase to use when executing the statement
nullableboolean | nullNoWhen false, SQL NULL values are returned as string "null"
parametersobject | nullNoStatement-level Snowflake parameters as a JSON object
request_idstring | nullNoUnique request identifier (UUID) used for idempotent retries
retryboolean | nullNoSet true when resubmitting a previously sent request with the same request_id
rolestring | nullNoRole to use when executing the statement
schemastring | nullNoSchema to use when executing the statement
timeoutinteger | nullNoMaximum number of seconds to wait for statement execution (minimum: 1)
warehousestring | nullNoWarehouse to use when executing the statement

Get Snowflake SQL API statement status and first partition result metadata by statement handle.

NameTypeRequiredDescription
statement_handlestringYesSnowflake statement handle returned by Execute Query
request_idstring | nullNoOptional request ID used when the statement was submitted

Get a specific result partition for a Snowflake SQL API statement.

NameTypeRequiredDescription
statement_handlestringYesSnowflake statement handle returned by Execute Query
partitionintegerYesPartition index to fetch (0-based, minimum: 0)
request_idstring | nullNoOptional request ID used when the statement was submitted

Cancel a running Snowflake SQL API statement by statement handle.

NameTypeRequiredDescription
statement_handlestringYesSnowflake statement handle to cancel
request_idstring | nullNoOptional request ID used when the statement was submitted

Query INFORMATION_SCHEMA.SCHEMATA for schema metadata.

NameTypeRequiredDescription
databasestringYesDatabase name
schema_likestring | nullNoOptional schema pattern
limitinteger | nullNoMaximum rows (minimum: 1)
rolestring | nullNoOptional role
warehousestring | nullNoOptional warehouse

Query INFORMATION_SCHEMA.TABLES for table metadata in a Snowflake database.

NameTypeRequiredDescription
databasestringYesDatabase name
schemastring | nullNoOptional schema filter
table_name_likestring | nullNoOptional table name pattern
limitinteger | nullNoMaximum number of rows (minimum: 1)
rolestring | nullNoOptional role
warehousestring | nullNoOptional warehouse

Query INFORMATION_SCHEMA.COLUMNS for column metadata.

NameTypeRequiredDescription
databasestringYesDatabase name
schemastring | nullNoOptional schema filter
tablestring | nullNoOptional table filter
column_name_likestring | nullNoOptional column name pattern
limitinteger | nullNoMaximum rows (minimum: 1)
rolestring | nullNoOptional role
warehousestring | nullNoOptional warehouse

Query INFORMATION_SCHEMA.TABLE_CONSTRAINTS.

NameTypeRequiredDescription
databasestringYesDatabase name
schemastring | nullNoOptional schema filter
tablestring | nullNoOptional table filter
constraint_typestring | nullNoOptional constraint type filter
limitinteger | nullNoMaximum rows (minimum: 1)
rolestring | nullNoOptional role
warehousestring | nullNoOptional warehouse

Query INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.

NameTypeRequiredDescription
databasestringYesDatabase name
schemastring | nullNoOptional schema filter
tablestring | nullNoOptional table filter
limitinteger | nullNoMaximum rows (minimum: 1)
rolestring | nullNoOptional role
warehousestring | nullNoOptional warehouse

Run SHOW DATABASES or SHOW SCHEMAS.

NameTypeRequiredDescription
object_typestringYesObject type to show. Allowed values: databases, schemas
database_namestring | nullNoOptional database scope for SHOW SCHEMAS
like_patternstring | nullNoOptional LIKE pattern
rolestring | nullNoOptional role
warehousestring | nullNoOptional warehouse

Run SHOW WAREHOUSES.

NameTypeRequiredDescription
like_patternstring | nullNoOptional LIKE pattern
rolestring | nullNoOptional role
warehousestring | nullNoOptional warehouse

Run SHOW GRANTS in common modes (to_role, to_user, of_role, on_object).

NameTypeRequiredDescription
grant_viewstringYesSHOW GRANTS variant. Allowed values: to_role, to_user, of_role, on_object
role_namestring | nullNoRole name (used for to_role and of_role)
user_namestring | nullNoUser name (used for to_user)
object_typestring | nullNoObject type for on_object
object_namestring | nullNoObject name for on_object
rolestring | nullNoOptional execution role
warehousestring | nullNoOptional warehouse

Run SHOW PRIMARY KEYS with optional scope.

NameTypeRequiredDescription
database_namestring | nullNoOptional database name for scope
schema_namestring | nullNoOptional schema name for scope
table_namestring | nullNoOptional table name for scope
rolestring | nullNoOptional role
warehousestring | nullNoOptional warehouse

Run SHOW IMPORTED KEYS or SHOW EXPORTED KEYS for a table.

NameTypeRequiredDescription
key_directionstringYesWhich command to run. Allowed values: imported, exported
table_namestringYesTable name
schema_namestring | nullNoOptional schema name
database_namestring | nullNoOptional database name
rolestring | nullNoOptional role
warehousestring | nullNoOptional warehouse