Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Environment:Truera Trulens Snowflake Connector Environment

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Data_Platform
Last Updated 2026-02-14 08:00 GMT

Overview

Python 3.9-3.12 environment with Snowflake Snowpark, SQLAlchemy connector, and Snowflake account credentials for trace persistence and server-side evaluation.

Description

This environment extends the core TruLens environment with Snowflake connectivity for enterprise-grade trace storage and feedback evaluation. It uses Snowpark Python for server-side stored procedure execution and Snowflake SQLAlchemy for database access. The environment is restricted to Python < 3.13 due to Snowpark compatibility constraints. Server-side evaluation packages feedback functions as Snowpark stored procedures that run within Snowflake infrastructure.

Usage

Use this environment when deploying TruLens with Snowflake as the backend for trace storage, leaderboard queries, or server-side feedback evaluation. Required for the Snowflake Observability Pipeline workflow and any `SnowflakeConnector`-based setup.

System Requirements

Category Requirement Notes
OS Any (OS Independent) Linux, macOS, Windows all supported
Python >= 3.9, < 3.13 Snowpark does not support Python 3.13+
Network Internet access Required for Snowflake connectivity

Dependencies

Python Packages

  • `trulens-core` >= 2.0.0
  • `snowflake-snowpark-python` >= 1.18
  • `snowflake-sqlalchemy` >= 1.6

Optional (Cortex Provider)

  • `snowflake-connector-python` >= 3.15
  • `snowflake-ml-python` >= 1.7.2

Credentials

The following Snowflake credentials must be available at runtime:

  • `SNOWFLAKE_ACCOUNT`: Snowflake account identifier.
  • `SNOWFLAKE_USER`: Snowflake username.
  • `SNOWFLAKE_USER_PASSWORD`: Snowflake user password.
  • `SNOWFLAKE_DATABASE`: Target database name.
  • `SNOWFLAKE_SCHEMA`: Target schema name.
  • `SNOWFLAKE_WAREHOUSE`: Compute warehouse name.

Quick Install

# Install Snowflake connector
pip install trulens-connectors-snowflake>=2.6.0

# Optional: Install Cortex provider for server-side LLM evaluation
pip install trulens-providers-cortex>=2.6.0

# Set credentials
export SNOWFLAKE_ACCOUNT="your_account"
export SNOWFLAKE_USER="your_user"
export SNOWFLAKE_USER_PASSWORD="your_password"
export SNOWFLAKE_DATABASE="your_db"
export SNOWFLAKE_SCHEMA="your_schema"
export SNOWFLAKE_WAREHOUSE="your_warehouse"

Code Evidence

Python version constraint from `src/connectors/snowflake/pyproject.toml:36`:

python = "^3.9,<3.13"

Environment variable usage from `src/benchmark/trulens/benchmark/benchmark_frameworks/tru_benchmark_experiment.py:34-39`:

os.environ["SNOWFLAKE_ACCOUNT"]
os.environ["SNOWFLAKE_USER"]
os.environ["SNOWFLAKE_USER_PASSWORD"]
os.environ["SNOWFLAKE_DATABASE"]
os.environ["SNOWFLAKE_SCHEMA"]
os.environ["SNOWFLAKE_WAREHOUSE"]

Snowflake SQLAlchemy version check from `src/core/trulens/core/database/sqlalchemy.py:144-156`:

snowflake_sqlalchemy_version = snowflake.sqlalchemy.__version__
if (snowflake_sqlalchemy_version
    and Version(snowflake_sqlalchemy_version) >= Version("1.7.2")
    and "url" in self.engine_params
    and "snowflake" in self.engine_params["url"]):

Common Errors

Error Message Cause Solution
`ImportError: snowflake-snowpark-python` Snowpark not installed `pip install trulens-connectors-snowflake`
`SnowflakeLoginError` Invalid credentials Verify all 6 `SNOWFLAKE_*` environment variables are set correctly
Python 3.13 incompatibility Using Python >= 3.13 Downgrade to Python 3.12 or earlier

Compatibility Notes

  • Python 3.13+: Snowpark Python does not support Python 3.13. This is the primary version restriction.
  • Snowflake ML >= 1.8.0: Enables JSON response format support for Cortex provider.
  • Snowflake ML >= 1.7.1: Minimum version for API response format compatibility.
  • Snowflake SQLAlchemy >= 1.7.2: Enables improved connection URL handling.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment