Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dagster_db-0.2.3.tar.gz (81.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dagster_db-0.2.3-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file dagster_db-0.2.3.tar.gz.

File metadata

  • Download URL: dagster_db-0.2.3.tar.gz
  • Upload date:
  • Size: 81.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.1

File hashes

Hashes for dagster_db-0.2.3.tar.gz
Algorithm Hash digest
SHA256 6f0e982143c401fba1ca696a4d00e3474566b7866564c7a34759086658fcff32
MD5 ddd21f562aaa32d8ec21db61d10690cf
BLAKE2b-256 7a8677a30834b1f497140918757f350ef4553f75e9a7d15d8c25cd36843a48d6

See more details on using hashes here.

File details

Details for the file dagster_db-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: dagster_db-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.1

File hashes

Hashes for dagster_db-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c969dd50c711733d4e47fd1e0480017394fdd464cda1d501b4c0db956c0b4646
MD5 fd661f0ad51481d32e2201086a69254d
BLAKE2b-256 de2960bf970bb3f5f5e77efc4ac5abf6af256d810823d80e8ea5b7d69f88b7f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page