Dagster IO managers and type handlers for databases
Project description
dagster-db
Dagster IO managers and type handlers for databases. Wraps the standard IO managers with useful functions that can be scpecific to each type handler, and provides better metadata out of the box.
- Apply custom generic transformations to ensure all outputs comply with database.
- Apply custom validation checks before deleting from / writing to the database.
- Add custom metadata.
Use polars, pandas or execute a jinja-templated SQL query on the database
with the custom SqlQuery class which builds dagsters powerful table slice
logic into an io-manager ready framework.
Use TypeHandlers out of the box, or extend to implement custom behaviours.
duckdb
Installation
uv add dagster-db[duckdb]
Definition
import dagster as dg
from dagster_db import build_custom_duckdb_io_manager
custom_io_manager = build_custom_duckdb_io_manager().configured({"database": "./.tmp/database.duckdb"})
defs = dg.Definitions(
...,
resources={"io_manager": custom_io_manager},
)
Usage
import dagster as dg
import polars as pl
from dagster_db import SqlQuery
@dg.asset
def my_asset(context: dg.AssetExecutionContext) -> pl.DataFrame:
return pl.DataFrame({"a": [1, 2, 3]})
@dg.asset
def my_asset_downstream(
context: dg.AssetExecutionContext,
my_asset: SqlQuery,
) -> SqlQuery:
return SqlQuery("SELECT *, a+1 AS b FROM {{ my_asset }}", my_asset)
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 dagster_db-0.2.1.tar.gz.
File metadata
- Download URL: dagster_db-0.2.1.tar.gz
- Upload date:
- Size: 81.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6506e5c9b03562ec52b5495414d97b5a1e37e9efe5b1d9908f53830278138fea
|
|
| MD5 |
d7967cea1b519c6078b8f0799bea1169
|
|
| BLAKE2b-256 |
f2da5aa8fef0eb88d8932fe4b1688c429b8cf55e9a257e989f57bf1b01a09454
|
File details
Details for the file dagster_db-0.2.1-py3-none-any.whl.
File metadata
- Download URL: dagster_db-0.2.1-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acc6cdcb2f904019698421a1660d9fd87f0f5962771d1473f10cffba7ded4a07
|
|
| MD5 |
5aaf58ae73530986e7a20e8a7bb24079
|
|
| BLAKE2b-256 |
7f28c69ba3b2621fcefc6bdd98fa8fc2497f6552126f9cac7052744a6b5c3902
|