analyzing-data
astronomer/agents
Query your data warehouse with SQL to answer business questions and metrics.
What is analyzing-data?
Executes SQL queries against a data warehouse to retrieve counts, metrics, trends, aggregations, and ad-hoc analysis. Use this skill whenever you need to look up data, find customers, calculate metrics, or answer questions that require warehouse data.
- Execute SQL queries and return results as Polars or Pandas DataFrames
- Cache query strategies and table mappings to speed up repeated questions
- Run multiple independent queries concurrently for faster analysis
- Discover table schemas and column mappings via INFORMATION_SCHEMA or codebase search
- Handle long-running queries with configurable timeouts (default 120s)
- Support pattern and concept caching to learn from previous analyses
How to install analyzing-data
npx skills add https://github.com/astronomer/agents --skill analyzing-data- Access to a configured data warehouse (Snowflake or compatible)
- uv (Python package manager) installed
- SQL knowledge to write or interpret queries
How to use analyzing-data
- 1.Check the pattern cache for a known query strategy: `uv run scripts/cli.py pattern lookup "<question>"`
- 2.If no pattern exists, look up table mappings: `uv run scripts/cli.py concept lookup <concept>`
- 3.Execute your SQL query: `uv run scripts/cli.py exec "df = run_sql('SELECT ...')"`
- 4.Cache the concept and pattern for future use: `uv run scripts/cli.py concept learn <name> <TABLE>` and `uv run scripts/cli.py pattern learn <name> -q "..." -s "..." -t "TABLE"`
- 5.Present the results to the user
Use cases
- Count active users or customers matching specific criteria
- Calculate revenue, conversion, or engagement metrics over time
- Find top-N items (products, customers, regions) by performance
- Join data across multiple tables to answer cross-domain questions
- Discover trends or anomalies in historical data
- Data analysts answering ad-hoc business questions
- Product managers tracking KPIs and metrics
- Engineers debugging data issues or validating datasets
- Business stakeholders requesting reports or data lookups
analyzing-data FAQ
Use `run_sql_many(['SELECT ...', 'SELECT ...'])` to execute queries concurrently instead of sequentially. This is faster but fails fast if any query errors.
By default, `exec` waits 120 seconds before timing out. Use the `-t` flag to increase the timeout: `uv run scripts/cli.py exec "..." -t 600` for 10 minutes.
Use `uv run scripts/cli.py concept lookup <concept>` to find cached mappings, or query `INFORMATION_SCHEMA` directly. See reference/discovery-warehouse.md for large table handling.
Yes. After executing a query, use `uv run scripts/cli.py pattern learn <name> -q "question" -s "step" -t "TABLE"` to cache the strategy. Future similar questions will find and reuse it.
The kernel auto-terminates after 2 hours of idle time. Set `ASTRO_KERNEL_IDLE_TIMEOUT=0` to disable auto-termination.
Full instructions (SKILL.md)
Source of truth, from astronomer/agents.
name: analyzing-data description: Queries the data warehouse with SQL and answers business questions about data. Use when answering anything that needs warehouse data - counts, metrics, trends, aggregations, joins across tables, data lookups, or ad-hoc SQL analysis (for example "who uses X", "how many Y", "show me Z", "find customers", "what is the count").
Data Analysis
Answer business questions by querying the data warehouse. The kernel auto-starts on first exec call.
All CLI commands below are relative to this skill's directory. Before running any scripts/cli.py command, cd to the directory containing this file.
Workflow
-
Pattern lookup — Check for a cached query strategy:
uv run scripts/cli.py pattern lookup "<user's question>"If a pattern exists, follow its strategy. Record the outcome after executing:
uv run scripts/cli.py pattern record <name> --success # or --failure -
Concept lookup — Find known table mappings:
uv run scripts/cli.py concept lookup <concept> -
Table discovery — If cache misses, search the codebase (
Grep pattern="<concept>" glob="**/*.sql") or queryINFORMATION_SCHEMA. See reference/discovery-warehouse.md. -
Execute query:
uv run scripts/cli.py exec "df = run_sql('SELECT ...')" uv run scripts/cli.py exec "print(df)" -
Cache learnings — Always cache before presenting results:
# Cache concept → table mapping uv run scripts/cli.py concept learn <concept> <TABLE> -k <KEY_COL> # Cache query strategy (if discovery was needed) uv run scripts/cli.py pattern learn <name> -q "question" -s "step" -t "TABLE" -g "gotcha" -
Present findings to user.
Kernel Functions
| Function | Returns |
|---|---|
run_sql(query, limit=100) | Polars DataFrame |
run_sql_pandas(query, limit=100) | Pandas DataFrame |
run_sql_many(queries, limit=100) | List of Polars DataFrames (one per query) |
pl (Polars) and pd (Pandas) are pre-imported.
Run independent queries together with run_sql_many — they execute concurrently (Snowflake async / connection-pool fan-out) instead of one at a time:
uv run scripts/cli.py exec "dfs = run_sql_many(['SELECT ...', 'SELECT ...']); print(dfs[0])"
run_sql_many is fail-fast: if any query errors, the call raises and the results of the queries that succeeded are discarded. Use separate run_sql calls if you need partial results.
Timeouts: exec waits up to 120s by default, then interrupts the query and returns a "client stopped waiting" message (the query may still finish server-side). Raise it for known long-running queries: uv run scripts/cli.py exec "..." -t 600.
Idle kernel: the kernel self-terminates after 2h idle (preserving state until then). Override with ASTRO_KERNEL_IDLE_TIMEOUT (seconds; 0 disables).
CLI Reference
Kernel
uv run scripts/cli.py warehouse list # List warehouses
uv run scripts/cli.py start [-w name] # Start kernel (with optional warehouse)
uv run scripts/cli.py exec "..." # Execute Python code
uv run scripts/cli.py status # Kernel status
uv run scripts/cli.py restart # Restart kernel
uv run scripts/cli.py stop # Stop kernel
uv run scripts/cli.py install <pkg> # Install package
Concept Cache
uv run scripts/cli.py concept lookup <name> # Look up
uv run scripts/cli.py concept learn <name> <TABLE> -k <KEY_COL> # Learn
uv run scripts/cli.py concept list # List all
uv run scripts/cli.py concept import -p /path/to/warehouse.md # Bulk import
Pattern Cache
uv run scripts/cli.py pattern lookup "question" # Look up
uv run scripts/cli.py pattern learn <name> -q "..." -s "..." -t "TABLE" -g "gotcha" # Learn
uv run scripts/cli.py pattern record <name> --success # Record outcome
uv run scripts/cli.py pattern list # List all
uv run scripts/cli.py pattern delete <name> # Delete
Table Schema Cache
uv run scripts/cli.py table lookup <TABLE> # Look up schema
uv run scripts/cli.py table cache <TABLE> -c '[...]' # Cache schema
uv run scripts/cli.py table list # List cached
uv run scripts/cli.py table delete <TABLE> # Delete
Cache Management
uv run scripts/cli.py cache status # Stats
uv run scripts/cli.py cache clear [--stale-only] # Clear
References
- reference/discovery-warehouse.md — Large table handling, warehouse exploration, INFORMATION_SCHEMA queries
- reference/common-patterns.md — SQL templates for trends, comparisons, top-N, distributions, cohorts
Related skills
More from astronomer/agents and the wider catalog.

annotating-task-lineage
Annotate Airflow tasks with data lineage using inlets and outlets. Use when the user wants to add lineage metadata to tasks, specify input/output datasets, or enable lineage tracking for operators without built-in OpenLineage extraction.

authoring-dags
Workflow and best practices for writing Apache Airflow DAGs. Use when the user wants to create a new DAG, write pipeline code, or asks about DAG patterns and conventions. For testing and debugging DAGs, see the testing-dags skill.

checking-freshness
Quick data freshness check. Use when the user asks if data is up to date, when a table was last updated, if data is stale, or needs to verify data currency before using it.

cosmos-dbt-core
Use when turning a dbt Core project into an Airflow DAG/TaskGroup using Astronomer Cosmos. Does not cover dbt Fusion. Before implementing, verify dbt engine, warehouse, Airflow version, execution environment, DAG vs TaskGroup, and manifest availability.

cosmos-dbt-fusion
Use when running a dbt Fusion project with Astronomer Cosmos. Covers Cosmos 1.11+ configuration for Fusion on Snowflake/Databricks with ExecutionMode.LOCAL. Before implementing, verify dbt engine is Fusion (not Core), warehouse is supported, and local execution is acceptable. Does not cover dbt Core.

creating-openlineage-extractors
Create custom OpenLineage extractors for Airflow operators. Use when the user needs lineage from unsupported or third-party operators, wants column-level lineage, or needs complex extraction logic beyond what inlets/outlets provide.