Skip to content

Reference

Snowflake

Run SQL over the Snowflake SQL API through Alter Vault

Store a Snowflake programmatic access token (PAT) in Alter Vault and let agents run SQL over the Snowflake SQL API — without the token ever reaching agent code.

PropertyValue
Provider IDsnowflake
CategoryDatabase
Credential TypeProgrammatic Access Token

Sign in to Snowsight

Sign in to Snowsight.

Ensure a network policy is in place

Snowflake requires the user to be governed by a network policy before it will issue programmatic access tokens.

Generate a programmatic access token

Follow Snowflake’s programmatic access-token guide. In a worksheet, run:

ALTER USER my_user ADD PROGRAMMATIC ACCESS TOKEN agent_token
ROLE_RESTRICTION = 'MY_ROLE'
DAYS_TO_EXPIRY = 90;

Scope the token with ROLE_RESTRICTION so it carries only the privileges the integration needs.

Copy the token secret

Copy the token_secret from the command output — it is shown only once.

Open the Developer Portal

Go to portal.alterauth.com and navigate to the application.

Add Snowflake

Go to Managed Secrets > Add Provider > Snowflake.

Enter credentials

Paste the programmatic access token into the credential field.

Save

Click Save. You’ll receive a grant_id to use with the SDK.

Submit SQL to the account’s SQL API endpoint. The token is injected via the Authorization: Bearer header automatically.

response = await alter_app.request(
HttpMethod.POST,
"https://YOUR_ACCOUNT.snowflakecomputing.com/api/v2/statements",
grant_id="YOUR_GRANT_ID",
json={
"statement": "SELECT id, name FROM customers WHERE region = ?",
"bindings": {"1": {"type": "TEXT", "value": "EMEA"}},
"warehouse": "MY_WH",
"database": "MY_DB",
"schema": "PUBLIC",
"timeout": 60,
},
)
  • YOUR_ACCOUNT is the account identifier in the host (<account_identifier>.snowflakecomputing.com); the SQL API path is /api/v2/statements.
  • The SQL API runs one statement per request (set MULTI_STATEMENT_COUNT for batches); interactive sessions require a driver and are not available over the REST API.
  • Programmatic access tokens require a network policy on the user and expire after DAYS_TO_EXPIRY — rotate the stored credential before then.

Alter policy rules can target these attested operations and families for operation-level and parameter-aware controls.

Operation IDFamiliesMethodProvider path
SubmitStatementadmin, delete, read, writePOST/api/v2/statements
GetStatementStatusreadGET/api/v2/statements/{statementHandle}
CancelStatementwritePOST/api/v2/statements/{statementHandle}/cancel
createDatabasewritePOST/api/v2/databases
deleteDatabasedeleteDELETE/api/v2/databases/{name}
fetchDatabasereadGET/api/v2/databases/{name}
listDatabasesreadGET/api/v2/databases
createSchemawritePOST/api/v2/databases/{database}/schemas
listSchemasreadGET/api/v2/databases/{database}/schemas
createTablewritePOST/api/v2/databases/{database}/schemas/{schema}/tables
listTablesreadGET/api/v2/databases/{database}/schemas/{schema}/tables
createWarehousewritePOST/api/v2/warehouses
deleteWarehousedeleteDELETE/api/v2/warehouses/{name}
fetchWarehousereadGET/api/v2/warehouses/{name}
listWarehousesreadGET/api/v2/warehouses
createUseradminPOST/api/v2/users
fetchUserreadGET/api/v2/users/{name}
listUsersreadGET/api/v2/users
createRoleadminPOST/api/v2/roles
deleteRoleadmin, deleteDELETE/api/v2/roles/{name}
listRolesreadGET/api/v2/roles
listRoleGrantsreadGET/api/v2/roles/{name}/grants
grantPrivilegeadminPOST/api/v2/grants/{granteeType}/{granteeName}/{securableType}/{securableName}/privileges

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.