Overview
Tool Name
Purpose
The snowflake_tools suite gives you Snowflake-specific power that goes beyond standard SQL. Work with stages and files, run Python in Snowpark, and use Cortex search to retrieve AI-ranked results from indexed content.Key Features & Functions
Stage Operations
List, upload, read, and delete files in Snowflake stages to support file-based pipelines.
Snowpark Python
Execute Python against Snowflake data for analytics, data science, and ML.
Cortex Search
Run AI-powered search over configured services to surface relevant content quickly.
Artifacts
Persist outputs and files as artifacts for easy sharing and traceability.
Unless your workflow specifies otherwise, use your WORKSPACE database, schema, and stage to simplify file paths and permissions.
Input Parameters for Each Function
_list_stage_contents
Parameters
Name | Definition | Format |
---|---|---|
database | Target database name. | String |
schema | Target schema name. | String |
stage | Stage name to inspect. | String |
pattern | Filename or glob-style pattern to filter results. | String |
_add_file_to_stage
Parameters
Name | Definition | Format |
---|---|---|
database | Database that owns the stage. | String |
schema | Schema that owns the stage. | String |
stage | Stage name. | String |
file_name | Full local path to the file to upload. | String |
target_path | Optional subfolder on the stage, exclude the filename. | String |
_delete_file_from_stage
Parameters
Name | Definition | Format |
---|---|---|
database | Database that owns the stage. | String |
schema | Schema that owns the stage. | String |
stage | Stage name. | String |
file_name | Original filename on the stage, with optional path. | String |
_read_file_from_stage
Parameters
Name | Definition | Format |
---|---|---|
database | Database that owns the stage. | String |
schema | Schema that owns the stage. | String |
stage | Stage name. | String |
file_name | Filename on the stage, with optional path. | String |
return_contents | Return file contents instead of only the filename. | Boolean |
is_binary | Treat file as binary when returning contents. | Boolean |
max_bytes | Maximum bytes to return when streaming content. Default 10000. | Integer |
save_artifacts | Save the downloaded file as an artifact with a link for reuse and sharing. | Boolean |
For binary reads, set
is_binary = true
. If you also set save_artifacts = true
, the file will be persisted and returned with an artifact link._cortex_search
Parameters
Name | Definition | Format |
---|---|---|
service_name | Name of the configured Cortex search service. | String |
query | Short text query to search for. | String |
top_n | Number of top results to return. Default 15, max 25. | Integer |
_run_snowpark_python
Parameters
Name | Definition | Format |
---|---|---|
code | Python code to execute in Snowpark. | String |
purpose | Human-readable explanation used for validation and auditing. | String |
packages | Comma-separated list of additional packages to install. | String |
note_id | Execute previously saved code by note id instead of passing code . | String |
save_artifacts | Persist outputs as artifacts for later access and sharing. | Boolean |
Use Cases
- Create data visualizations from Snowflake data with matplotlib or similar libraries.
- Perform advanced statistical analysis on enterprise datasets.
- Build and run machine learning models inside Snowflake.
- Process CSVs by uploading to stages and analyzing with Snowpark.
- Generate automated reports and dashboards with Python-based workflows.
- Search indexed documentation and knowledge bases using Cortex AI.
- Spin up temporary data workflows that leverage Snowflake compute.
- Develop custom transformation scripts for large-scale datasets.
- Combine SQL and Python for interactive analysis.
- Manage file-based pipelines for ETL and data quality validation.
Workflow/How It Works
- Land files with
_add_file_to_stage
or verify with_list_stage_contents
. - Transform and analyze using
_run_snowpark_python
with access to Snowflake data. - Discover content via
_cortex_search
for AI-ranked retrieval when needed. - Retrieve or share with
_read_file_from_stage
, optionally saving results as artifacts.
Integration Relevance
- data_connector_tools for SQL-centric operations that complement Snowpark workloads.
- file_manager_tools to register outputs and maintain lineage.
- artifact_manager_tools to persist visualizations, CSVs, or notebooks.
- project_manager_tools to track Snowflake tasks across missions and todos.
- image_tools to inspect or analyze images generated by Snowpark code.
Snowpark jobs and frequent stage operations can incur compute and storage costs. Ensure roles, warehouses, and stage privileges are configured before running workloads.
Configuration Details
- Use forward slashes in stage paths and avoid special characters.
- Ensure your role has
USAGE
on the database and schema, plus required privileges on the stage. - In Snowpark, set a top-level
result
variable in your code to capture returned output. - Cortex services must be provisioned and indexed before you can query them.
- Package names should exclude standard libraries and list only additional needs.
Limitations or Notes
- Stage and Snowpark operations require appropriate Snowflake permissions.
- Large files and long-running Python jobs may hit resource or timeout limits.
- First-time package installation in Snowpark can add latency.
- Cortex search availability depends on account features and service configuration.
- Complex Python tasks can require significant compute and time.
- Binary file handling may require
is_binary = true
andmax_bytes
tuning. - Network connectivity to Snowflake is required for all operations.
Output
- Stage Operations Listings, upload confirmations, deletions, and resolved file paths.
- File Content Returned text or binary bytes with size and encoding info when requested.
- Cortex Search Ranked results with relevance scores and snippets.
- Snowpark Execution
Captured
result
, console logs, and optional artifacts for downstream use. - Artifacts Artifact ids and links for reports, images, or data files created during execution.
- Errors Clear messages for permission issues, invalid paths, missing services, or runtime failures.