Documentation

Snowflake Connectors

Snowflake Connectors provide powerful integration options for accessing and querying Snowflake data warehouses. These connectors enable seamless data extraction, transformation, and analysis capabilities through direct loading and URI connections, making it easy to incorporate Snowflake's robust data platform into your RAG applications.

1.1 Snowflake Loader

Snowflake Loader Configuration

Snowflake Loader Interface

Description

The Snowflake Loader connector enables direct data loading and querying capabilities from your Snowflake data warehouse. This connector provides a streamlined interface for executing SQL queries, retrieving results, and integrating Snowflake's powerful data processing capabilities into your applications.

Use Cases

  • Executing complex analytical queries on large datasets
  • Real-time data extraction for business intelligence dashboards
  • Integrating historical data analysis with machine learning models
  • Performing data transformations and aggregations at scale
  • Creating automated data pipelines for reporting and analytics

Inputs

  • Connection URI: Snowflake connection string (required)

    Example: snowflake://username:password@account.region.snowflakecomputing.com/

  • Database: Target database name (required)

    Example: ANALYTICS_DB

  • Schema: Database schema (required)

    Example: PUBLIC

  • Query: SQL query to execute (required)

    Example: SELECT * FROM SALES_DATA WHERE REGION = 'WEST' AND YEAR = 2023

  • Warehouse: Snowflake warehouse to use (optional)

    Example: COMPUTE_WH

  • Role: Snowflake role to assume (optional)

    Example: ANALYST_ROLE

Outputs

The connector returns query results in JSON format with metadata about the execution.

Example Output:

{
  "status": "success",
  "rows_affected": 1000,
  "execution_time": "1.23 seconds",
  "results": [
    {
      "REGION": "WEST",
      "SALES_AMOUNT": 50000.00,
      "PRODUCT_CATEGORY": "Electronics",
      "TRANSACTION_DATE": "2023-09-15"
    },
    {
      "REGION": "WEST",
      "SALES_AMOUNT": 75000.00,
      "PRODUCT_CATEGORY": "Furniture",
      "TRANSACTION_DATE": "2023-09-16"
    }
  ],
  "column_metadata": [
    {
      "name": "REGION",
      "type": "VARCHAR"
    },
    {
      "name": "SALES_AMOUNT",
      "type": "NUMBER(10,2)"
    },
    {
      "name": "PRODUCT_CATEGORY",
      "type": "VARCHAR"
    },
    {
      "name": "TRANSACTION_DATE",
      "type": "DATE"
    }
  ]
}

Implementation Notes

  • Optimize queries using appropriate filters and indexes
  • Consider using parameterized queries for better security
  • Implement proper error handling for failed queries
  • Monitor warehouse credit usage for cost optimization
  • Use appropriate warehouse sizing for query performance

1.2 Snowflake URI Connection

Description

The Snowflake URI Connection connector provides a simplified connection method using URI-based authentication. This connector is ideal for applications that require persistent connections or need to handle multiple Snowflake accounts and databases.

Use Cases

  • Setting up persistent database connections
  • Managing multiple Snowflake account connections
  • Implementing connection pooling for better resource utilization
  • Handling cross-database queries and operations
  • Building multi-tenant applications with separate database contexts

Inputs

  • Username: Snowflake username (required)

    Example: ANALYST_USER

  • Password: Authentication password (required)

    Example: ••••••••

  • Account: Snowflake account identifier (required)

    Example: xy12345.us-east-1

  • Database: Target database name (required)

    Example: PRODUCTION_DB

  • Schema: Database schema (required)

    Example: PUBLIC

Outputs

The connector returns connection status and details in JSON format.

Example Output:

{
  "status": "connected",
  "connection_id": "0123456789abcdef",
  "session_info": {
    "database": "PRODUCTION_DB",
    "schema": "PUBLIC",
    "warehouse": "COMPUTE_WH",
    "role": "ANALYST_ROLE",
    "account": "xy12345.us-east-1"
  },
  "connection_params": {
    "application": "RAG_APP",
    "client_version": "2.8.2",
    "session_id": "12345678"
  }
}

Implementation Notes

  • Implement connection pooling for better resource management
  • Handle connection timeouts and automatic reconnection
  • Use environment variables for sensitive connection details
  • Monitor connection status and implement health checks
  • Implement proper connection cleanup and resource release

Important Security Notes:

  • Ensure proper Snowflake account permissions and network access are configured
  • Use secure password management and avoid hardcoding credentials
  • Implement proper role-based access control (RBAC)
  • Regular audit of access patterns and query history
  • Keep client libraries and dependencies up to date