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.2.tar.gz (81.5 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.2-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dagster_db-0.2.2.tar.gz
Algorithm Hash digest
SHA256 121514fd5f6a1cecc1bae1507462dc29bd79979c9a9d742ea295baed9e06be37
MD5 6c97fae4255c18ecbb7fa0630e943ef1
BLAKE2b-256 bb1a0c0ea6c921ea7200234a27b45e4bde7da58362f3f22e4f152de364412fd3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for dagster_db-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b85dea8990efdc429c9d6b1b512087bde987285aef4aa0f65afae5ca1e337aff
MD5 d33200f14db40ff6ffd7784485a7767c
BLAKE2b-256 7c9e3a42e72674f2e7eb19ada32d4b029c50ca149194e9194aa66f013fe3a090

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