DBT Enexis Python Postgres adapter - Run python scripts from any dbt project.
Project description
DEPP - DBT Python Postgres Adapter
This package support for running python models in dbt for postgres directly within your dbt project Inspired on dbt-fal but made to be both extremely high performance and fully typed Also supports polars dataframe besides pandas and more are coming soon
Features
- Run Python scripts as dbt models - Write Python logic directly in your dbt project
- Fully typed Python models - Complete type safety with IDE support (see typing docs)
- Multiple DataFrame libraries - Support for both pandas and Polars dataframes (more comming soon)
- Auto-generated documentation - Python docstrings automatically become model descriptions in dbt docs
- High performance - Blazing fast execution using connectorx and asyncpg
- PostgreSQL integration - Seamless integration with PostgreSQL databases
Installation
Install using uv (recommended):
uv add dbt-debb
Or using pip:
pip install dbt-depp
Quick Start
- Add to your
profiles.yml: Make sure to both add a db_profile with all your details and add your database and schema
your_project:
target: dev
outputs:
dev:
type: depp
db_profile: dev_postgres
database: example_db
schema: test
dev_postgres:
type: postgres
host: localhost
user: postgres
password: postgres
port: 5432
database: example_db
schema: test
threads: 1
- Create Python models in your dbt project:
# models/customer_analysis.py
"""Analyze customer purchase patterns using Polars."""
import polars as pl
from dbt.adapters.depp.typing import PolarsDbt, SessionObject
def model(dbt: PolarsDbt, session: SessionObject) -> pl.DataFrame:
# Reference existing models with full type safety
customers_df = dbt.ref("customers")
orders_df = dbt.ref("orders")
# Perform analysis using Polars
result = (
customers_df
.join(orders_df, on="customer_id", how="inner")
.group_by("customer_region")
.agg([
pl.col("order_amount").sum().alias("total_revenue"),
pl.col("customer_id").n_unique().alias("unique_customers"),
pl.col("order_amount").mean().alias("avg_order_value")
])
.sort("total_revenue", descending=True)
)
return result
dbt run!
Development
This project uses uv for dependency management:
# Install dependencies
uv sync
# Run tests
uv run pytest
# Build package
uv build
Documentation
- Getting Started Guide - Complete setup guide including profiles.yml configuration and first Python models
- Type Safety Guide - Complete guide to using DEPP's type system for better IDE support and code safety
Requirements
- Python >= 3.12
- dbt-core >= 1.10.0
- PostgreSQL database
License
This project is open source and available under the MIT License.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dbt_depp-0.4.2.tar.gz.
File metadata
- Download URL: dbt_depp-0.4.2.tar.gz
- Upload date:
- Size: 196.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c9964b2b4727b8720acc2a1ec785e9245865a1205b38cab4ac7e8c7afcec050
|
|
| MD5 |
20a591c71c2a20726982a47d286082e6
|
|
| BLAKE2b-256 |
541cbd416cda573ee0a10dc8ddad660b3166c494cd3a11e3252c7a76bcf41450
|
Provenance
The following attestation bundles were made for dbt_depp-0.4.2.tar.gz:
Publisher:
publish.yml on YassinCh/depp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbt_depp-0.4.2.tar.gz -
Subject digest:
9c9964b2b4727b8720acc2a1ec785e9245865a1205b38cab4ac7e8c7afcec050 - Sigstore transparency entry: 1134839530
- Sigstore integration time:
-
Permalink:
YassinCh/depp@c666eb5e02b3fa77a11e30d7ece95e93be5b9f2b -
Branch / Tag:
refs/tags/v0.4.2 - Owner: https://github.com/YassinCh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c666eb5e02b3fa77a11e30d7ece95e93be5b9f2b -
Trigger Event:
release
-
Statement type:
File details
Details for the file dbt_depp-0.4.2-py3-none-any.whl.
File metadata
- Download URL: dbt_depp-0.4.2-py3-none-any.whl
- Upload date:
- Size: 50.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b26b1cdd0312c11d63c89a9ab2ab35873d73e7ea9dda858f31432bf9b9262c6e
|
|
| MD5 |
56a057ca785e578066c82997abd60d30
|
|
| BLAKE2b-256 |
4f23fbfa96832765a9efe3430d06fc4f4f9bb5b8a58da06d892da7b475313886
|
Provenance
The following attestation bundles were made for dbt_depp-0.4.2-py3-none-any.whl:
Publisher:
publish.yml on YassinCh/depp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbt_depp-0.4.2-py3-none-any.whl -
Subject digest:
b26b1cdd0312c11d63c89a9ab2ab35873d73e7ea9dda858f31432bf9b9262c6e - Sigstore transparency entry: 1134839541
- Sigstore integration time:
-
Permalink:
YassinCh/depp@c666eb5e02b3fa77a11e30d7ece95e93be5b9f2b -
Branch / Tag:
refs/tags/v0.4.2 - Owner: https://github.com/YassinCh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c666eb5e02b3fa77a11e30d7ece95e93be5b9f2b -
Trigger Event:
release
-
Statement type: