Install & Compatibility
Where this runs
tested against v0.29.20 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 4.740s · 141.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 13.0s · import 4.346s · 140MB
145MB installed
● package 145MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
DagsterPostgresStorage
✓ from dagster_postgres import DagsterPostgresStorage
✗ from dagster_postgres import postgres_resource
PostgresRunStorage
✓ from dagster_postgres import PostgresRunStorage
PostgresEventLogStorage
✓ from dagster_postgres import PostgresEventLogStorage
This example defines a simple Dagster asset that uses `postgres_resource` to connect to a PostgreSQL database. It demonstrates how to configure the resource using environment variables and then obtain a connection to execute a query. Ensure you have the necessary PostgreSQL environment variables set for the connection to succeed.
import os
from dagster import Definitions, asset, EnvVar
from dagster_postgres import postgres_resource
@asset(compute_kind="sql")
def my_postgres_asset(postgres: postgres_resource):
"""A simple asset that connects to PostgreSQL and runs a dummy query."""
with postgres.get_connection() as conn:
with conn.cursor() as cursor:
cursor.execute("SELECT 1;")
result = cursor.fetchone()
print(f"Postgres query result: {result}")
# In a typical asset, you'd load/transform/store data here.
defs = Definitions(
assets=[my_postgres_asset],
resources={
"postgres": postgres_resource.configured({
"database": EnvVar("POSTGRES_DB"),
"host": EnvVar("POSTGRES_HOST"),
"port": EnvVar("POSTGRES_PORT"),
"user": EnvVar("POSTGRES_USER"),
"password": EnvVar("POSTGRES_PASSWORD"),
})
}
)
# To run this example, set environment variables (e.g., in your shell):
# export POSTGRES_DB=your_db_name
# export POSTGRES_HOST=localhost
# export POSTGRES_PORT=5432
# export POSTGRES_USER=your_user
# export POSTGRES_PASSWORD=your_password
# Then execute using `dagster dev -f your_file.py` and materialize `my_postgres_asset` in the UI.
Upgrade
Version history
0.29.20latest on PyPI · released Aug 27, 2026
Audit
Dependencies
dagsterrequireddagster-postgres is an integration library for the Dagster orchestration framework and requires the core `dagster` library.
psycopg2-binaryoptionalRequired for database connectivity if you were relying on it as a transitive dependency before version 0.28.18; now must be explicitly installed.