Skip to content

Commit 56953fb

Browse files
author
roller100 (BearingNode)
committed
Migrate dbt producer from DuckDB to PostgreSQL
- Replace DuckDB adapter with PostgreSQL adapter in profiles.yml - Update requirements.txt: dbt-postgres, psycopg2-binary - Rename scenario csv_to_duckdb_local to csv_to_postgres_local - Update scenario config.json lineage_level to postgres - Add docker-compose.yml for local PostgreSQL container - Update GitHub Actions workflow with PostgreSQL service container - Fix README.md installation instructions (dbt-duckdb -> dbt-postgres) - Update SPECIFICATION_COVERAGE_ANALYSIS.md to reference PostgreSQL Tested locally: 22 OpenLineage events generated successfully with postgres namespace. Signed-off-by: roller100 (BearingNode) <contact@bearingnode.com>
1 parent 5152a1a commit 56953fb

File tree

15 files changed

+62
-19
lines changed

15 files changed

+62
-19
lines changed

.github/workflows/producer_dbt.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@ on:
3030
jobs:
3131
run-dbt-tests:
3232
runs-on: ubuntu-latest
33+
34+
services:
35+
postgres:
36+
image: postgres:15-alpine
37+
env:
38+
POSTGRES_USER: testuser
39+
POSTGRES_PASSWORD: testpass
40+
POSTGRES_DB: dbt_test
41+
ports:
42+
- 5432:5432
43+
options: >-
44+
--health-cmd "pg_isready -U testuser -d dbt_test"
45+
--health-interval 10s
46+
--health-timeout 5s
47+
--health-retries 5
48+
3349
steps:
3450
- name: Checkout code
3551
uses: actions/checkout@v4
@@ -56,7 +72,7 @@ jobs:
5672
run: |
5773
python -m pip install --upgrade pip
5874
pip install dbt-core==${{ inputs.dbt_release }}
59-
pip install dbt-duckdb
75+
pip install dbt-postgres
6076
pip install openlineage-dbt==${{ inputs.ol_release }}
6177
pip install -r producer/dbt/test_runner/requirements.txt
6278

producer/dbt/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ To execute the test suite, you will need a local clone of the main [OpenLineage
8585
pip install -r test_runner/requirements.txt
8686
```
8787

88-
2. **Install dbt and the DuckDB adapter**:
88+
2. **Install dbt and the PostgreSQL adapter**:
8989
```bash
90-
pip install dbt-core dbt-duckdb
90+
pip install dbt-core dbt-postgres
9191
```
9292

9393
3. **Install the OpenLineage dbt integration**:

producer/dbt/SPECIFICATION_COVERAGE_ANALYSIS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This document analyzes the OpenLineage specification coverage achieved by our db
66
## Test Configuration
77
- **OpenLineage Specification**: 2-0-2 (target specification)
88
- **dbt-openlineage Implementation**: 1.37.0
9-
- **Test Scenario**: CSV → dbt models → DuckDB (includes data quality tests)
9+
- **Test Scenario**: CSV → dbt models → PostgreSQL (includes data quality tests)
1010
- **Events Generated**: 20 events total
1111
- 3 dbt models (START/COMPLETE pairs)
1212
- 5 data quality test suites (START/COMPLETE pairs)
@@ -31,7 +31,7 @@ This document analyzes the OpenLineage specification coverage achieved by our db
3131

3232
| Facet | Status | Coverage | Notes |
3333
|-------|--------|----------|-------|
34-
|`processing_engine` | **TESTED** | Full validation | DuckDB processing engine captured |
34+
|`processing_engine` | **TESTED** | Full validation | PostgreSQL processing engine captured |
3535
|`parent` | **TESTED** | Full validation | Parent-child run relationships |
3636
|`dbt_run` | **TESTED** | Basic validation | dbt-specific run metadata (non-standard) |
3737
|`dbt_version` | **TESTED** | Basic validation | dbt version information (non-standard) |
@@ -92,7 +92,7 @@ This document analyzes the OpenLineage specification coverage achieved by our db
9292

9393
### 🏗️ Infrastructure Constraints
9494
- **Local File Transport**: Missing network-based transport scenarios
95-
- **DuckDB Only**: Missing other database-specific facets
95+
- **PostgreSQL Only**: Missing other database-specific facets
9696
- **No CI/CD Context**: Missing environment variables, build metadata
9797
- **No Version Control**: Missing source code location tracking
9898

producer/dbt/docker-compose.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: '3.8'
2+
3+
services:
4+
postgres:
5+
image: postgres:15-alpine
6+
container_name: dbt-test-postgres
7+
environment:
8+
POSTGRES_USER: testuser
9+
POSTGRES_PASSWORD: testpass
10+
POSTGRES_DB: dbt_test
11+
ports:
12+
- "5432:5432"
13+
healthcheck:
14+
test: ["CMD-SHELL", "pg_isready -U testuser -d dbt_test"]
15+
interval: 10s
16+
timeout: 5s
17+
retries: 5
18+
volumes:
19+
- postgres_data:/var/lib/postgresql/data
20+
21+
volumes:
22+
postgres_data:
23+
name: dbt_test_postgres_data

producer/dbt/runner/profiles.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ openlineage_compatibility_test:
22
target: dev
33
outputs:
44
dev:
5-
type: duckdb
6-
path: './openlineage_test.duckdb'
7-
schema: main
8-
threads: 1
5+
type: postgres
6+
host: "{{ env_var('DBT_POSTGRES_HOST', 'localhost') }}"
7+
port: "{{ env_var('DBT_POSTGRES_PORT', '5432') | as_number }}"
8+
user: "{{ env_var('DBT_POSTGRES_USER', 'testuser') }}"
9+
password: "{{ env_var('DBT_POSTGRES_PASSWORD', 'testpass') }}"
10+
dbname: "{{ env_var('DBT_POSTGRES_DB', 'dbt_test') }}"
11+
schema: "{{ env_var('DBT_POSTGRES_SCHEMA', 'main') }}"
12+
threads: 4
File renamed without changes.

producer/dbt/scenarios/csv_to_duckdb_local/config.json renamed to producer/dbt/scenarios/csv_to_postgres_local/config.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"max_version": "2-0-2",
1717
"min_version": "1.0.0",
1818
"lineage_level": {
19-
"duckdb": ["dataset", "column"]
19+
"postgres": ["dataset", "column"]
2020
}
2121
}
2222
},
@@ -28,7 +28,7 @@
2828
"max_version": "2-0-2",
2929
"min_version": "1.0.0",
3030
"lineage_level": {
31-
"duckdb": ["dataset"]
31+
"postgres": ["dataset"]
3232
}
3333
}
3434
},
@@ -40,7 +40,7 @@
4040
"max_version": "2-0-2",
4141
"min_version": "1.0.0",
4242
"lineage_level": {
43-
"duckdb": ["dataset", "transformation"]
43+
"postgres": ["dataset", "transformation"]
4444
}
4545
}
4646
},
@@ -52,7 +52,7 @@
5252
"max_version": "2-0-2",
5353
"min_version": "1.0.0",
5454
"lineage_level": {
55-
"duckdb": ["column", "transformation"]
55+
"postgres": ["column", "transformation"]
5656
}
5757
}
5858
}

producer/dbt/scenarios/csv_to_duckdb_local/events/column_lineage_event.json renamed to producer/dbt/scenarios/csv_to_postgres_local/events/column_lineage_event.json

File renamed without changes.

producer/dbt/scenarios/csv_to_duckdb_local/events/lineage_event.json renamed to producer/dbt/scenarios/csv_to_postgres_local/events/lineage_event.json

File renamed without changes.

producer/dbt/scenarios/csv_to_duckdb_local/events/schema_event.json renamed to producer/dbt/scenarios/csv_to_postgres_local/events/schema_event.json

File renamed without changes.

0 commit comments

Comments
 (0)