Snowflake Switchboard AI (snowflake-switchboard-ai)
snowflake-switchboard-ai is a metadata-driven, zero-cost query router for Snowflake and Snowpark.
It automatically inspects your query execution plan before execution to estimate projected data volumes (bytesAssigned), dynamically routing your queries to the optimal warehouse tier to maximize performance while minimizing compute costs.
🚀 Key Features
- Zero-Cost Telemetry Analysis: Uses Snowflake's native
SYSTEM$EXPLAIN_PLAN_JSONto inspect query payloads without executing them or incurring compute charges. - Intelligent Tier Routing: Automatically maps query byte sizes to your configured warehouse hierarchy.
- Frictionless Execution: Provides a clean callable shorthand syntax (
sb(...)) that analyzes, routes, executes, and renders results automatically. - Flexible Configuration: Works out of the box with sensible size defaults or accepts custom data thresholds tailored to your workload.
📦 Step-by-Step Guide
Step 1: Installation
Install the package directly from PyPI into your environment or notebook:
pip install snowflake-switchboard-ai
Step 2: Quick Start (Default Thresholds)
Simply pass your existing Snowpark session and ordered warehouse list. The switchboard automatically applies smart data size thresholds out of the box:
from switchboard import MultiTierSwitchboard
# 1. Initialize with automatic default thresholds
sb = MultiTierSwitchboard(
session=session,
warehouses=["xsmall_wh", "small_wh", "medium_wh", "large_wh", "xlarge_wh", "xxlarge_wh"]
)
# 2. Run queries effortlessly using callable shorthand
sb("""
SELECT c_mktsegment, COUNT(*)
FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.CUSTOMER
GROUP BY c_mktsegment
""")
📊 Default Threshold Mapping
When custom thresholds are not specified, MultiTierSwitchboard routes queries using these exact default payload limits:
| Warehouse Tier | Byte Boundary | Data Volume Limit |
|---|---|---|
| Tier 1 (e.g., XS) | < 1,000,000,000 bytes |
Under 1 GB |
| Tier 2 (e.g., Small) | < 5,000,000,000 bytes |
Under 5 GB |
| Tier 3 (e.g., Medium) | < 20,000,000,000 bytes |
Under 20 GB |
| Tier 4 (e.g., Large) | < 50,000,000,000 bytes |
Under 50 GB |
| Tier 5 (e.g., X-Large) | < 100,000,000,000 bytes |
Under 100 GB |
| Tier 6 (e.g., 2X-Large) | < 500,000,000,000 bytes |
Under 500 GB |
Step 3: Custom Thresholds (Optional)
If you want granular control over when queries switch warehouse tiers, pass your own custom byte limits via thresholds:
# Pass custom byte limits matching your warehouse boundaries:
sb = MultiTierSwitchboard(
session=session,
warehouses=["xsmall_wh", "small_wh", "medium_wh"],
thresholds=[1_000_000_000, 10_000_000_000]
)
📸 Live Execution Output
Here is how snowflake-switchboard-ai looks in action inside a Snowflake Notebook:
⚙️ How It Works
- Pre-Check Phase: Intercepts query execution and executes
SYSTEM$EXPLAIN_PLAN_JSON(...)at zero compute cost. - Telemetry Analysis: Recursively parses the JSON plan tree to calculate estimated
bytesAssigned. - Dynamic Routing: Automatically executes a fast
USE WAREHOUSE <optimal_tier>before triggering data retrieval.
🛠️ Requirements
- Python
3.8+ snowflake-snowpark-python >= 1.0.0
📜 License
Distributed under the MIT License. See LICENSE for more information.
Metadata
Release files for snowflake-switchboard-ai 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| snowflake_switchboard_ai-0.2.3.tar.gz | 5.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| snowflake_switchboard_ai-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.6 kB
Release files / snowflake_switchboard_ai-0.2.3.tar.gz
| Download URL | snowflake_switchboard_ai-0.2.3.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d174e441b82b3ecfda5aebf4dcf7af212872c571bc5842ced5921e09926b57c
|
|
BLAKE2b-256 checksum How to use checksums |
c0d7382a00387850b2942a3d6023d2ddf192ecaaa56cc26595d3ae06310fd0bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.9
|
Release files / snowflake_switchboard_ai-0.2.3-py3-none-any.whl
| Download URL | snowflake_switchboard_ai-0.2.3-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b26e820d4912b966bf614c63c8e4f673476dae0ba9c39f0f4f6367b55daf5bc
|
|
BLAKE2b-256 checksum How to use checksums |
776dfa830e118e3e31b99cb83eb0e5d22ebe3d9cc0c2eb18fe48087fe5d5d82b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.9
|
Security for snowflake-switchboard-ai 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.