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 AuthCreate 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.

      Copy redirect URI from Scalekit dashboard

    • 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 AuthConnections and open the connection you created.

    • Enter your credentials:

      • Client ID (from the SQL output)
      • Client Secret (from the SQL output)

      Add credentials 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)

Cancel a running Snowflake SQL API statement by statement handle.

NameTypeRequiredDescription
request_idstringNoOptional request ID used when the statement was submitted
statement_handlestringYesSnowflake statement handle to cancel

Execute one or more SQL statements against Snowflake using the SQL API. Requires a valid Snowflake OAuth2 connection. Use semicolons to submit multiple statements.

NameTypeRequiredDescription
asyncbooleanNoExecute statement asynchronously and return a statement handle
bindingsobjectNoBind variables object for ’?’ placeholders in the SQL statement
databasestringNoDatabase to use when executing the statement
nullablebooleanNoWhen false, SQL NULL values are returned as the string “null”
parametersobjectNoStatement-level Snowflake parameters as a JSON object
request_idstringNoUnique request identifier (UUID) used for idempotent retries
retrybooleanNoSet true when resubmitting a previously sent request with the same request_id
rolestringNoRole to use when executing the statement
schemastringNoSchema to use when executing the statement
statementstringYesSQL statement to execute. Use semicolons to send multiple statements in one request.
timeoutintegerNoMaximum number of seconds to wait for statement execution
warehousestringNoWarehouse to use when executing the statement

Query INFORMATION_SCHEMA.COLUMNS for column metadata.

NameTypeRequiredDescription
column_name_likestringNoOptional column name pattern
databasestringYesDatabase name
limitintegerNoMaximum rows
rolestringNoOptional role
schemastringNoOptional schema filter
tablestringNoOptional table filter
warehousestringNoOptional warehouse

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

NameTypeRequiredDescription
partitionintegerYesPartition index to fetch (0-based)
request_idstringNoOptional request ID used when the statement was submitted
statement_handlestringYesSnowflake statement handle returned by Execute Query

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

NameTypeRequiredDescription
request_idstringNoOptional request ID used when the statement was submitted
statement_handlestringYesSnowflake statement handle returned by Execute Query

Query INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.

NameTypeRequiredDescription
databasestringYesDatabase name
limitintegerNoMaximum rows
rolestringNoOptional role
schemastringNoOptional schema filter
tablestringNoOptional table filter
warehousestringNoOptional warehouse

Query INFORMATION_SCHEMA.SCHEMATA for schema metadata.

NameTypeRequiredDescription
databasestringYesDatabase name
limitintegerNoMaximum rows
rolestringNoOptional role
schema_likestringNoOptional schema pattern
warehousestringNoOptional warehouse

Query INFORMATION_SCHEMA.TABLE_CONSTRAINTS.

NameTypeRequiredDescription
constraint_typestringNoOptional constraint type filter
databasestringYesDatabase name
limitintegerNoMaximum rows
rolestringNoOptional role
schemastringNoOptional schema filter
tablestringNoOptional table filter
warehousestringNoOptional warehouse

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

NameTypeRequiredDescription
databasestringYesDatabase name
limitintegerNoMaximum number of rows
rolestringNoOptional role
schemastringNoOptional schema filter
table_name_likestringNoOptional table name pattern
warehousestringNoOptional warehouse

Run SHOW DATABASES or SHOW SCHEMAS.

NameTypeRequiredDescription
database_namestringNoOptional database scope for SHOW SCHEMAS
like_patternstringNoOptional LIKE pattern
object_typestringYesObject type to show
rolestringNoOptional role
warehousestringNoOptional warehouse

Run SHOW GRANTS in common modes (to role, to user, of role, on object).

NameTypeRequiredDescription
grant_viewstringYesSHOW GRANTS variant
object_namestringNoObject name for on_object
object_typestringNoObject type for on_object
rolestringNoOptional execution role
role_namestringNoRole name (for to_role/of_role)
user_namestringNoUser name (for to_user)
warehousestringNoOptional warehouse

Run SHOW IMPORTED KEYS or SHOW EXPORTED KEYS for a table. For reliable execution in this environment, use fully-qualified scope (database_name + schema_name + table_name).

NameTypeRequiredDescription
database_namestringNoOptional database name (recommended with schema_name)
key_directionstringYesWhich command to run
rolestringNoOptional role
schema_namestringNoOptional schema name (recommended with database_name)
table_namestringYesTable name (use with schema_name and database_name for fully-qualified scope)
warehousestringNoOptional warehouse

Run SHOW PRIMARY KEYS with optional scope. When using schema_name (or schema_name + table_name), database_name is required for fully-qualified scope.

NameTypeRequiredDescription
database_namestringNoOptional database name for scope (required when schema_name is set)
rolestringNoOptional role
schema_namestringNoOptional schema name for scope
table_namestringNoOptional table name for scope
warehousestringNoOptional warehouse

Run SHOW WAREHOUSES.

NameTypeRequiredDescription
like_patternstringNoOptional LIKE pattern
rolestringNoOptional role
warehousestringNoOptional warehouse