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.6.tar.gz (117.8 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.6-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dagster_db-0.2.6.tar.gz
Algorithm Hash digest
SHA256 344f53536bb8d95263b05980ea014a4a42d5e0068bbe2fd815cec3260629a4e2
MD5 b130b97090be4eb2cf1d9e0dfa31ff6f
BLAKE2b-256 b2e1cfa4c8ca372e4ce0ebce499cba4e5c77ac84474e812a8a7a377690c38c32

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for dagster_db-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6effd3b8776c1d4604c3033cbc1a461b47f4c07b6bbe3fa29058613b553d4a86
MD5 6aacc3042b671265866d7f858cf7a1b9
BLAKE2b-256 73afaa60a1bc79151dee1ffc6350bd04ea3c7703d67bf21ac86848cff43997cf

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