Skip to main content

Snowflake Connector

The Snowflake connector enables AxonFlow agents to execute SQL queries against Snowflake data warehouses with policy enforcement, warehouse management, and comprehensive audit logging.

Overview

PropertyValue
Typesnowflake
EditionEnterprise
Auth MethodsKey-Pair, Username/Password, OAuth (External Browser)
Capabilitiesquery, execute, warehouse_management, parameterized_queries

Use Cases

  • Execute analytical queries for business intelligence agents
  • Access data warehouse tables for RAG context retrieval
  • Generate revenue reports and customer analytics summaries
  • Run data quality checks and aggregations

Prerequisites

  • AxonFlow Enterprise license (requires Enterprise Edition)
  • Snowflake account with a warehouse and database
  • One of the following authentication methods:
    • Key-Pair (recommended for server-to-server, most secure)
    • Username/Password (simplest setup)
  • Service account with appropriate Snowflake roles

Snowflake Service Account Setup

-- Create a role for AxonFlow
CREATE ROLE axonflow_role;

-- Grant warehouse usage
GRANT USAGE ON WAREHOUSE compute_wh TO ROLE axonflow_role;

-- Grant database and schema access
GRANT USAGE ON DATABASE analytics_db TO ROLE axonflow_role;
GRANT USAGE ON SCHEMA analytics_db.public TO ROLE axonflow_role;

-- Grant read access to tables
GRANT SELECT ON ALL TABLES IN SCHEMA analytics_db.public TO ROLE axonflow_role;
GRANT SELECT ON FUTURE TABLES IN SCHEMA analytics_db.public TO ROLE axonflow_role;

-- Create user and assign role
CREATE USER axonflow_svc
PASSWORD = 'secure_password'
DEFAULT_ROLE = axonflow_role
DEFAULT_WAREHOUSE = compute_wh
DEFAULT_NAMESPACE = analytics_db.public;

GRANT ROLE axonflow_role TO USER axonflow_svc;

Configuration

Environment Variables

# Required
MCP_snowflake_ACCOUNT="your-account.us-east-1"
MCP_snowflake_USERNAME="axonflow_svc"
MCP_snowflake_DATABASE="analytics_db"
MCP_snowflake_WAREHOUSE="compute_wh"

# Authentication - Password
MCP_snowflake_PASSWORD="secure_password"

# Authentication - Key-Pair (recommended)
# MCP_snowflake_PRIVATE_KEY_FILE="/secrets/snowflake/rsa_key.p8"
# MCP_snowflake_PRIVATE_KEY_PASSPHRASE="key_passphrase"

# Optional
MCP_snowflake_SCHEMA="public"
MCP_snowflake_ROLE="axonflow_role"
MCP_snowflake_TIMEOUT="60s"
MCP_snowflake_MAX_RETRIES="3"

Configuration Options

OptionTypeRequiredDefaultDescription
accountstringYes-Snowflake account identifier (e.g., your-account.us-east-1)
usernamestringYes-Snowflake username
passwordstringNo*-Password (for password auth)
private_key_filestringNo*-Path to private key file (for key-pair auth)
private_key_passphrasestringNo-Passphrase for encrypted private key
databasestringYes-Default database
warehousestringYes-Default warehouse
schemastringNopublicDefault schema
rolestringNo-Snowflake role to use
timeoutstringNo60sQuery timeout
max_retriesintegerNo3Maximum retry attempts

Connector Config (Customer Portal)

{
"name": "snowflake-analytics",
"type": "snowflake",
"options": {
"account": "your-account.us-east-1",
"database": "analytics_db",
"warehouse": "compute_wh",
"schema": "public",
"role": "axonflow_role",
"timeout": 60,
"max_retries": 3
},
"credentials": {
"username": "axonflow_svc",
"password": "secure_password"
}
}

Installation

Install the Snowflake connector via the connector marketplace API:

curl -X POST http://localhost:8081/api/v1/connectors/snowflake/install \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"name": "snowflake-analytics",
"config": {
"account": "your-account.us-east-1",
"username": "axonflow_svc",
"password": "secure_password",
"database": "analytics_db",
"warehouse": "compute_wh"
}
}'

Operations

Execute a Query

curl -X POST https://your-axonflow.example.com/mcp/resources/query \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"connector": "snowflake-analytics",
"statement": "SELECT DATE_TRUNC('\''month'\'', order_date) AS month, SUM(amount) AS revenue, COUNT(*) AS order_count FROM orders WHERE order_date >= ? AND status = ? GROUP BY month ORDER BY month DESC LIMIT 12",
"parameters": {
"0": "2025-01-01",
"1": "completed"
}
}'

Response:

{
"success": true,
"rows": [
{
"MONTH": "2025-12-01T00:00:00Z",
"REVENUE": 1250000.00,
"ORDER_COUNT": 4520
},
{
"MONTH": "2025-11-01T00:00:00Z",
"REVENUE": 1180000.00,
"ORDER_COUNT": 4210
}
],
"row_count": 2,
"duration_ms": 850,
"connector": "snowflake-analytics"
}

Customer Segmentation Query

curl -X POST https://your-axonflow.example.com/mcp/resources/query \
-d '{
"connector": "snowflake-analytics",
"statement": "SELECT segment, COUNT(DISTINCT customer_id) AS customers, ROUND(AVG(lifetime_value), 2) AS avg_ltv, ROUND(SUM(lifetime_value), 2) AS total_ltv FROM customer_segments GROUP BY segment ORDER BY total_ltv DESC",
"parameters": {}
}'

Insert Records

curl -X POST https://your-axonflow.example.com/mcp/tools/execute \
-d '{
"connector": "snowflake-analytics",
"action": "insert",
"statement": "INSERT INTO audit_events (event_id, event_type, user_id, timestamp, details) VALUES (?, ?, ?, ?, ?)",
"parameters": {
"0": "evt-12345",
"1": "data_export",
"2": "user-789",
"3": "2025-12-08T10:30:00Z",
"4": "{\"rows_exported\": 1500, \"destination\": \"s3\"}"
}
}'

Response:

{
"success": true,
"rows_affected": 1,
"duration_ms": 120,
"message": "insert executed successfully",
"connector": "snowflake-analytics"
}

Supported Operations

OperationDescription
query (SELECT)Execute SELECT queries with parameterized values
insertInsert records into tables
updateUpdate records with WHERE clause
deleteDelete records with WHERE clause

Limitations

  • Query timeout: Long-running queries may exceed the configured timeout. Use LIMIT and targeted filters to reduce execution time.
  • Warehouse costs: Queries consume Snowflake credits. The warehouse auto-suspends based on its configuration, but long-running queries keep it active.
  • Concurrent queries: The number of concurrent queries is limited by warehouse size. Scale up the warehouse for parallel workloads.
  • Data types: Semi-structured data (VARIANT, OBJECT, ARRAY) is returned as JSON strings.
  • DDL operations: CREATE, ALTER, and DROP statements are not supported through this connector for safety. Use Snowflake's native tools for schema changes.

Troubleshooting

Authentication Failed

  • Verify the account identifier format (e.g., org-account.region or account.region)
  • For password auth: check username and password are correct
  • For key-pair auth: ensure the private key matches the public key registered in Snowflake
  • Verify the user account is not locked or expired

Warehouse Suspended

  • If queries fail with "warehouse suspended" errors, the connector attempts to auto-resume
  • Check that the service account role has OPERATE privilege on the warehouse
  • Verify the warehouse auto-resume setting: ALTER WAREHOUSE compute_wh SET AUTO_RESUME = TRUE

Query Timeout

  • Increase the timeout configuration for long-running queries
  • Optimize queries with proper filtering and LIMIT clauses
  • Consider using a larger warehouse size for complex analytics
  • Check the Snowflake query history for execution plans

Health Check

curl https://your-axonflow.example.com/mcp/connectors/snowflake-analytics/health

Response:

{
"healthy": true,
"latency_ms": 250,
"details": {
"account": "your-account.us-east-1",
"database": "analytics_db",
"warehouse": "compute_wh",
"warehouse_state": "STARTED",
"role": "axonflow_role"
}
}