Snowflake
Connect Cardinal to Snowflake to explore schemas and query your data warehouse using natural language.
Overview
With the Snowflake integration, the AI agent can:
- Explore databases and schemas — browse tables, columns, and data types
- Run queries — answer questions about your data using natural language
- Analyze warehouse data — leverage Snowflake’s compute for complex analytical queries
Capabilities
| Capability | Enabled |
|---|---|
| Explore | Always |
| Agent | Always |
Configuration
Settings
| Field | Required | Default | Description |
|---|---|---|---|
| Account Identifier | Yes | — | Snowflake account identifier (e.g., xy12345.us-east-1) |
| Warehouse | Yes | — | Warehouse name to use for queries (e.g., COMPUTE_WH) |
| Database | Yes | — | Database name (e.g., ANALYTICS) |
| Schema | No | PUBLIC | Default schema. Comma-separated for multiple schemas |
Credentials
| Field | Required | Description |
|---|---|---|
| Username | Yes | Snowflake username (e.g., SVC_CARDINAL). Its only role must be the read-only role described in Database role |
| Password | Yes | Password or programmatic access token |
Prerequisites
- A Snowflake account with an active warehouse
- A dedicated user whose only role is read-only:
USAGEon the warehouse, database and schemas, plusSELECTon their tables and views. This is required, not a recommendation. See Database role - Network policies configured to allow connections from Cardinal (if applicable)
Finding Your Account Identifier
Your Snowflake account identifier can be found in the URL you use to access Snowflake. For example, if your URL is https://xy12345.us-east-1.snowflakecomputing.com, your account identifier is xy12345.us-east-1.
How Cardinal keeps queries read-only
Version: the enforcement described in this section needs Cardinal UI v1.97.16 or later. Earlier versions check statements less strictly, so the least-privilege role below matters even more on them.
Cardinal only runs read queries against Snowflake. Every query the agent runs goes through two checks:
- Statement check. Cardinal accepts a single
SELECTorWITHstatement. It refuses multiple statements, write and DDL keywords,INTO,CALL, everySYSTEM$function, andIDENTIFIER(…)(…)calls, where the function name is computed. - Single statement per request. Cardinal sets
MULTI_STATEMENT_COUNT = 1on each request, so Snowflake refuses a request that holds more than one statement, even if your account allows multi-statement requests.
Snowflake has no read-only session or transaction mode, so Cardinal can’t make the database itself refuse writes. The grants on the role Cardinal uses are what keep it read-only, which is why the next section is required.
Database role (required)
Cardinal must connect as a dedicated user whose only role can read, and nothing else. Don’t reuse a user that holds ACCOUNTADMIN, SYSADMIN, SECURITYADMIN or any role that can write. Any Cardinal member or admin, or an agent acting for one, can run queries through this integration, and those queries run with this user’s privileges.
This applies the same way whether you run Cardinal UI self-hosted in your own VPC or use Cardinal SaaS: in both cases every query runs as the user you enter under Credentials.
The role must have only
USAGEon the warehouse, the database and each schemaSELECTon the tables and views in those schemas (current and future)
The user must not have
- Any other role. Snowflake can activate every role granted to a user as a secondary role, so a second role’s write grants would apply to Cardinal’s queries
INSERT,UPDATE,DELETE,TRUNCATE,OWNERSHIPor anyCREATE …privilege, directly or throughPUBLIC. Check that thePUBLICrole in your account has no write grantsOPERATE,MODIFYor any other warehouse privilege beyondUSAGE, or any account-level privilege
Example
Run as SECURITYADMIN (or a role with MANAGE GRANTS), replacing COMPUTE_WH, ANALYTICS and PUBLIC with your warehouse, database and schema:
USE ROLE SECURITYADMIN;
CREATE ROLE CARDINAL_RO;
GRANT USAGE ON WAREHOUSE COMPUTE_WH TO ROLE CARDINAL_RO;
GRANT USAGE ON DATABASE ANALYTICS TO ROLE CARDINAL_RO;
GRANT USAGE ON SCHEMA ANALYTICS.PUBLIC TO ROLE CARDINAL_RO;
GRANT SELECT ON ALL TABLES IN SCHEMA ANALYTICS.PUBLIC TO ROLE CARDINAL_RO;
GRANT SELECT ON ALL VIEWS IN SCHEMA ANALYTICS.PUBLIC TO ROLE CARDINAL_RO;
GRANT SELECT ON FUTURE TABLES IN SCHEMA ANALYTICS.PUBLIC TO ROLE CARDINAL_RO;
GRANT SELECT ON FUTURE VIEWS IN SCHEMA ANALYTICS.PUBLIC TO ROLE CARDINAL_RO;
CREATE USER SVC_CARDINAL
PASSWORD = 'use-a-strong-password'
DEFAULT_ROLE = CARDINAL_RO
DEFAULT_WAREHOUSE = COMPUTE_WH;
GRANT ROLE CARDINAL_RO TO USER SVC_CARDINAL;Repeat the schema grants for each schema you list in Schema.
Check the role
-- Should list only USAGE and SELECT
SHOW GRANTS TO ROLE CARDINAL_RO;
-- Should list CARDINAL_RO and no other role
SHOW GRANTS TO USER SVC_CARDINAL;Setup
- Navigate to Settings > Integrations and click Add Integration
- Select Snowflake
- Enter the Account Identifier, Warehouse, and Database
- Optionally set the Schema (defaults to
PUBLIC) - Enter the Username and Password
- Click Test Connection to verify connectivity
- Click Save
What This Enables
Once configured, you can ask the AI agent questions like:
- “What’s the total revenue by region this quarter?”
- “Show me the schema for the ORDERS table”
- “How many distinct users accessed the platform yesterday?”
Reach out to support@cardinalhq.io for support or to ask questions not answered in our documentation.