migrating-sql-to-dbt

Solid

Converts legacy SQL to modular dbt models. Use when migrating SQL to dbt for: (1) Converting stored procedures, views, or raw SQL files to dbt models (2) Task mentions "migrate", "convert", "legacy SQL", "transform to dbt", or "modernize" (3) Breaking monolithic queries into modular layers (discovers project conventions first) (4) Porting existing data pipelines or ETL to dbt patterns Checks for existing models/sources, builds and validates layer by layer.

Data & Documents 113 stars 8 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 85/100

Stars 20%
68
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# dbt Migration **Don't convert everything at once. Build and validate layer by layer.** ## Workflow ### 1. Analyze Legacy SQL ```bash cat <legacy_sql_file> ``` Identify all tables referenced in the query. ### 2. Check What Already Exists ```bash # Search for existing models/sources that reference the table grep -r "<table_name>" models/ --include="*.sql" --include="*.yml" find models/ -name "*.sql" | xargs grep -l "<table_name>" ``` For each table referenced in the legacy SQL: 1. Check if an existing model already references this table 2. Check if a source definition exists 3. If neither exists, ask user: "Table X not found - should I create it as a source?" Only proceed to intermediate/mart layers after all dependencies exist. ### 3. Create Missing Sources ```yaml # models/staging/sources.yml version: 2 sources: - name: raw_database schema: raw_schema tables: - name: orders description: Raw orders from source system - name: customers description: Raw customer records ``` ### 4. Build Staging Layer One staging model per source table. Follow existing project naming conventions. **Build before proceeding:** ```bash dbt build --select <staging_model> ``` ### 5. Build Intermediate Layer (if needed) Extract complex joins/logic into intermediate models. **Build incrementally:** ```bash dbt build --select <intermediate_model> ``` ### 6. Build Mart Layer Final business-facing model with aggregations. ### 7. Validate Migratio...

Details

Author
AltimateAI
Repository
AltimateAI/data-engineering-skills
Created
6 months ago
Last Updated
1 weeks ago
Language
N/A
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Solid

creating-dbt-models

Creates dbt models following project conventions. Use when working with dbt models for: (1) Creating new models (any layer - discovers project's naming conventions first) (2) Task mentions "create", "build", "add", "write", "new", or "implement" with model, table, or SQL (3) Modifying existing model logic, columns, joins, or transformations (4) Implementing a model from schema.yml specs or expected output requirements Discovers project conventions before writing. Runs dbt build (not just compile) to verify.

113 Updated 1 weeks ago
AltimateAI
Data & Documents Listed

dbt-patterns

dbt model design, ref chains, sources, tests, macros, incremental strategies, materializations, and documentation best practices. Use this skill whenever the user is writing or reviewing dbt models, configuring dbt tests, designing model layers (staging/intermediate/marts), asking about incremental models, choosing materializations, writing macros, setting up sources.yml, or troubleshooting dbt run/test failures. Also trigger when the user mentions dbt refs, lineage graphs, model dependencies, dbt Cloud, the dbt CLI, or when they want to transform data already in the warehouse using SQL. If the project uses dbt at all, this skill should be active for any transformation questions.

1 Updated 1 weeks ago
Methasit-Pun
AI & Automation Solid

refactoring-dbt-models

Safely refactors dbt models with downstream impact analysis. Use when restructuring dbt models for: (1) Task mentions "refactor", "restructure", "extract", "split", "break into", or "reorganize" (2) Extracting CTEs to intermediate models or creating macros (3) Modifying model logic that has downstream consumers (4) Renaming columns, changing types, or reorganizing model dependencies Analyzes all downstream dependencies BEFORE making changes.

113 Updated 1 weeks ago
AltimateAI