Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.asteragents.com/llms.txt

Use this file to discover all available pages before exploring further.

What it does

The Snowflake SQL tool executes SQL queries directly on your Snowflake data warehouse. Perfect for data analysis, reporting, business intelligence, and accessing large-scale datasets with Snowflake’s cloud performance.
Requires Snowflake Integration: You need to set up a Snowflake integration before agents can use this tool.

Key features

  • Execute any SQL query on Snowflake warehouses
  • Automatic warehouse management and suspension
  • Enterprise-grade security and performance
  • Support for complex analytical queries
  • Clean, structured result formatting

Parameters

ParameterTypeRequiredDescription
querystringYesThe SQL query to execute on Snowflake

Common use cases

Data analysis and reporting

SELECT 
  DATE_TRUNC('month', order_date) as month,
  SUM(revenue) as total_revenue,
  COUNT(DISTINCT customer_id) as unique_customers
FROM sales_data 
WHERE order_date >= '2024-01-01'
GROUP BY month
ORDER BY month DESC;
Analyze sales trends and customer metrics.

Customer segmentation

SELECT 
  customer_segment,
  AVG(lifetime_value) as avg_ltv,
  COUNT(*) as customer_count
FROM customer_analytics
WHERE last_purchase_date >= DATEADD(month, -6, CURRENT_DATE())
GROUP BY customer_segment
ORDER BY avg_ltv DESC;
Segment customers based on behavior and value.

Performance monitoring

SELECT 
  warehouse_name,
  AVG(execution_time) as avg_execution_time,
  SUM(credits_used) as total_credits
FROM query_history
WHERE start_time >= DATEADD(day, -7, CURRENT_DATE())
GROUP BY warehouse_name
ORDER BY total_credits DESC;
Monitor warehouse performance and costs.

Data quality checks

SELECT 
  table_name,
  COUNT(*) as row_count,
  COUNT(DISTINCT primary_key) as unique_keys,
  SUM(CASE WHEN primary_key IS NULL THEN 1 ELSE 0 END) as null_keys
FROM information_schema.tables t
JOIN your_database.your_schema.your_table data ON 1=1
GROUP BY table_name;
Validate data quality and integrity.

Complex analytics

WITH monthly_cohorts AS (
  SELECT 
    customer_id,
    DATE_TRUNC('month', first_purchase_date) as cohort_month,
    DATE_TRUNC('month', order_date) as order_month
  FROM customer_orders
)
SELECT 
  cohort_month,
  COUNT(DISTINCT customer_id) as cohort_size,
  AVG(DATEDIFF(month, cohort_month, order_month)) as avg_months_active
FROM monthly_cohorts
GROUP BY cohort_month
ORDER BY cohort_month;
Perform advanced cohort analysis.

Snowflake-specific features

  • Automatic scaling: Warehouses scale based on query complexity
  • Zero-copy cloning: Access cloned data without additional storage costs
  • Time travel: Query historical data states
  • Secure data sharing: Access shared datasets across organizations
  • Semi-structured data: Query JSON, Parquet, and other formats natively

Best practices

  • Use appropriate warehouse sizes for your query complexity
  • Leverage Snowflake’s columnar storage with SELECT specific columns
  • Use clustering keys for large tables to improve performance
  • Take advantage of result caching for repeated queries
  • Monitor credit usage and optimize expensive queries
  • Use LIMIT clauses for exploratory queries

Troubleshooting

“Warehouse not found” or “Access denied”
  • Verify your Snowflake integration is properly configured
  • Check that the specified warehouse exists and is accessible
  • Ensure your user has the necessary permissions
“SQL compilation error”
  • Validate your SQL syntax for Snowflake
  • Check that table and column names exist
  • Verify data types in your queries
“Insufficient privileges”
  • Ensure your user has SELECT permissions on the tables
  • Check that you have USAGE permissions on the database and schema
  • Verify warehouse usage permissions
“Query timeout”
  • Consider using a larger warehouse for complex queries
  • Optimize your query with proper filtering and indexing
  • Break large queries into smaller, more focused ones