Initialize Warehouse Schema
Generate a comprehensive, user-editable schema reference file for the data warehouse.
Scripts: ../analyzing-data/scripts/ — All CLI commands below are relative to the analyzing-data skill's directory. Before running any scripts/cli.py command, cd to ../analyzing-data/ relative to this file.
What This Does
- Discovers all databases, schemas, tables, and columns from the warehouse
- Enriches with codebase context (dbt models, gusty SQL, schema docs)
- Records row counts and identifies large tables
- Generates
.astro/warehouse.md- a version-controllable, team-shareable reference - Enables instant concept→table lookups without warehouse queries
Process
Step 1: Read Warehouse Configuration
Get the list of databases to discover (e.g., databases: [HQ, ANALYTICS, RAW]).
Step 2: Search Codebase for Context (Parallel)
Launch a subagent to find business context in code:
Step 3: Parallel Warehouse Discovery
Launch one subagent per database using the Task tool:
Run all subagents in parallel (single message with multiple Task calls).
Step 4: Discover Categorical Value Families
For key categorical columns (like OPERATOR, STATUS, TYPE, FEATURE), discover value families:
Group related values into families by common prefix/suffix (e.g., Export* for ExportCSV, ExportJSON, ExportParquet).
Step 5: Merge Results
Combine warehouse metadata + codebase context:
- Quick Reference table - concept → table mappings (pre-populated from code if found)
- Categorical Columns - value families for key filter columns
- Database sections - one per database
- Schema subsections - tables grouped by schema
- Table details - columns, row counts, descriptions from code, warnings
Step 6: Generate warehouse.md
Write the file to:
.astro/warehouse.md(default - project-specific, version-controllable)~/.astro/agents/warehouse.md(if--globalflag)
Output Format
{Inferred relationships based on column names like *_ID}
Command Options
Step 7: Pre-populate Cache
After generating warehouse.md, populate the concept cache:
Step 8: Offer CLAUDE.md Integration (Ask User)
Ask the user:
Would you like to add the Quick Reference table to your CLAUDE.md file?
This ensures the schema mappings are always in context for data queries, improving accuracy from ~25% to ~100% for complex queries.
Options:
- Yes, add to CLAUDE.md (Recommended) - Append Quick Reference section
- No, skip - Use warehouse.md and cache only
If user chooses Yes:
- Check if
.claude/CLAUDE.mdorCLAUDE.mdexists - If exists, append the Quick Reference section (avoid duplicates)
- If not exists, create
.claude/CLAUDE.mdwith just the Quick Reference
Quick Reference section to add:
If yes: Append the Quick Reference section to .claude/CLAUDE.md or CLAUDE.md.
After Generation
Tell the user:
Refresh Behavior
When --refresh is specified:
- Read existing warehouse.md
- Preserve all HTML comments (
<!-- ... -->) - Preserve Quick Reference table entries (user-added)
- Preserve user-added descriptions
- Update row counts and add new tables
- Mark removed tables with
<!-- REMOVED -->comment
Cache Staleness & Schema Drift
The runtime cache has a 7-day TTL by default. After 7 days, cached entries expire and will be re-discovered on next use.
When to Refresh
Run /astronomer-data:warehouse-init --refresh when:
- Schema changes: Tables added, renamed, or removed
- Column changes: New columns added or types changed
- After deployments: If your data pipeline deploys schema migrations
- Weekly: As a good practice, even if no known changes
Signs of Stale Cache
Watch for these indicators:
- Queries fail with "table not found" errors
- Results seem wrong or outdated
- New tables aren't being discovered
Manual Cache Reset
If you suspect cache issues:

