Skip to Content

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

CapabilityEnabled
ExploreAlways
AgentAlways

Configuration

Settings

FieldRequiredDefaultDescription
Account IdentifierYes—Snowflake account identifier (e.g., xy12345.us-east-1)
WarehouseYes—Warehouse name to use for queries (e.g., COMPUTE_WH)
DatabaseYes—Database name (e.g., ANALYTICS)
SchemaNoPUBLICDefault schema. Comma-separated for multiple schemas

Credentials

FieldRequiredDescription
UsernameYesSnowflake username (e.g., SVC_CARDINAL). Its only role must be the read-only role described in Database role
PasswordYesPassword or programmatic access token

Prerequisites

  • A Snowflake account with an active warehouse
  • A dedicated user whose only role is read-only: USAGE on the warehouse, database and schemas, plus SELECT on 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:

  1. Statement check. Cardinal accepts a single SELECT or WITH statement. It refuses multiple statements, write and DDL keywords, INTO, CALL, every SYSTEM$ function, and IDENTIFIER(…)(…) calls, where the function name is computed.
  2. Single statement per request. Cardinal sets MULTI_STATEMENT_COUNT = 1 on 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

  • USAGE on the warehouse, the database and each schema
  • SELECT on 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, OWNERSHIP or any CREATE … privilege, directly or through PUBLIC. Check that the PUBLIC role in your account has no write grants
  • OPERATE, MODIFY or any other warehouse privilege beyond USAGE, 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

  1. Navigate to Settings > Integrations and click Add Integration
  2. Select Snowflake
  3. Enter the Account Identifier, Warehouse, and Database
  4. Optionally set the Schema (defaults to PUBLIC)
  5. Enter the Username and Password
  6. Click Test Connection to verify connectivity
  7. 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.

Last updated on