Przejdź do treści
Biblioteka skilli
Dane i analityka · Konwersja i formaty

migrating-sql-to-dbt

/migrating-sql-to-dbt

Konwertuje starszy SQL na modułowe modele dbt: procedury składowane, widoki i surowe pliki SQL, z rozbiciem monolitycznych zapytań na warstwy zgodne z konwencjami projektu.

Licencja
MIT
Ostatnia zmiana repozytorium
15.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 15.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Konwertuje starszy SQL na modułowe modele dbt: procedury składowane, widoki i surowe pliki SQL, z rozbiciem monolitycznych zapytań na warstwy zgodne z konwencjami projektu.

Wyzwalacze z opisu

migrateconvertlegacy SQLtransform to dbtmodernize
Oryginalny opis (EN)

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.

Jak działa

  1. Workflow
  2. Migration Checklist
  3. Common Migration Patterns
  4. Anti-Patterns
Sekcje z nagłówków SKILL.md, w oryginale · 103 linii, 369 słów
Podgląd SKILL.md
---
name: migrating-sql-to-dbt
description: |
  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.
---

# 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 Migration

```bash
# Build entire lineage
dbt build --select +<final_model>
dbt show --select <final_model>
```

## Migration Checklist

- [ ] All source tables identified and documented
- [ ] Sources.yml created with descriptions
- [ ] Staging models: 1:1 with sources, renamed columns
- [ ] Intermediate models: business logic extracted
- [ ] Mart models: final aggregations
- [ ] Each layer compiles successfully
- [ ] Each layer builds successfully
- [ ] Row counts match original (manual validation)
- [ ] Tests added for key constraints

## Common Migration Patterns

- Nested subqueries → Separate models (staging → intermediate → mart)
- Temp tables → Ephemeral materialization `{{ config(materialized='ephemeral') }}`
- Hardcoded values → Variables `{{ var("name") }}`

## Anti-Patterns

- Converting entire legacy query to single dbt model
- Skipping the staging layer
- Not validating each layer before proceeding
- Keeping hardcoded values instead of using variables
- Not documenting business logic during migration

Wersje

W bazie nie ma innych skilli o nazwie migrating-sql-to-dbt.

Identyczna treść występuje jeszcze w 1 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.

Migawka bazy z 28.10.2026 · wersja paczki fc135513a078 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100dbt-migration-ms-sql-server
    Konwertuje DDL T-SQL z Microsoft SQL Server i Azure Synapse na modele dbt zgodne ze Snowflake: widoki, tabele i procedury składowane, z plikami schema.yml, testami i dokumentacją.
  • 100dbt-migration-ms-sql-server
    Konwertuje DDL T-SQL z Microsoft SQL Server i Azure Synapse na modele dbt zgodne ze Snowflake: widoki, tabele i procedury składowane, z plikami schema.yml, testami i dokumentacją.
  • 100creating-dbt-models
    Tworzy modele dbt zgodne z konwencjami projektu: nowe modele, zmiany logiki, kolumn i joinów oraz implementacja modelu ze specyfikacji schema.yml.
  • 100dbt
    Opisuje strukturę projektu dbt, wzorce SQL i dobre praktyki dla hurtowni analitycznej: modele, testy zapytań i nowe tabele analityczne.
  • 95dbt-bigquery
    Tworzy i optymalizuje modele oraz potoki dbt dla BigQuery, poprawia SQL w projekcie i konfiguruje nowy projekt dbt.
  • 100using-dbt-for-analytics-engineering
    Buduje i modyfikuje modele dbt, pisze transformacje SQL z ref() i source(), tworzy testy i waliduje wyniki przez dbt show.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.