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.4.tar.gz (117.2 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.4-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dagster_db-0.2.4.tar.gz
Algorithm Hash digest
SHA256 867b854a66dc0a88bb3aebb80ceee9672fc42fec2eb3e2bc170433b6499b1dfb
MD5 9c913ccecda333b06d612b832a9c58e1
BLAKE2b-256 3d65ae4dd880d664e32d621227917452ee418f81b2a252abffd8763f244bec76

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for dagster_db-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 717280f3c03f7759f1283681a4299634f4a4cfc208d0c3133c01de3259e3ab4f
MD5 0c28b23f67672b0ea5a3ce17b3a38515
BLAKE2b-256 4fc5586581dba51e81e7765c2869b3745047d5d1f5bafc1da3be90204fcf73cc

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