prefect-sqlalchemy
Prefect integrations for working with databases
What it is and what it does
prefect-sqlalchemy bridges SQLAlchemy and Prefect, allowing you to define database queries and connections as first-class objects in Prefect workflows. It provides blocks and tasks that wrap SQLAlchemy operations, making it straightforward to fetch data from databases, execute updates, or manage connections as part of a larger orchestrated pipeline.
The package is maintained by PrefectHQ as part of the official Prefect integration ecosystem. It depends on both sqlalchemy and prefect as runtime libraries, so you need both installed to use it. It supports Python 3.10 and later and is actively maintained, with recent commits and releases.
Use it for:
- Extract data from a database as a task within a Prefect flow, then pass it downstream for transformation or loading.
- Schedule recurring database queries (e.g., daily reports) using Prefect's deployment and scheduling system.
- Build multi-step ETL pipelines where database reads and writes are orchestrated alongside other data processing tasks.
- Manage database connections as reusable Prefect blocks, avoiding credential duplication across workflows.
- Monitor and log database operations through Prefect's observability and run history features.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates SQLAlchemy with Prefect workflows, enabling database operations as tasks and blocks within Prefect's orchestration framework.
Yes, if you are already using Prefect and need to orchestrate database operations. The package has low install friction, active maintenance, permissive licensing, and no known vulnerabilities. It is a straightforward integration that fits naturally into Prefect workflows. Install it only if you plan to use Prefect for workflow orchestration; it is not a standalone database tool.
Install
prefect-sqlalchemy on PyPI
pip
pip install prefect-sqlalchemyuv
uv add prefect-sqlalchemypoetry
poetry add prefect-sqlalchemyInstalling prefect-sqlalchemy
Before you install
Low friction: pure Python wheel with only two runtime dependencies (sqlalchemy and prefect). Active maintenance with a recent release on 2026-02-12 and continuous commits; part of the official Prefect ecosystem.
License in practice
Apache License 2.0 is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install prefect-sqlalchemy
from prefect_sqlalchemy import sqlalchemy_query
from sqlalchemy import text
result = sqlalchemy_query(
"postgresql://user:password@localhost/dbname",
text("SELECT * FROM table")
)
Requires Python 3.10 or later; requires a running Prefect server or agent to execute tasks.
Verify before relying
- Specific database systems supported (PostgreSQL, MySQL, SQLite, etc.) beyond the generic SQLAlchemy abstraction.
- Whether connection pooling, transaction management, or async query execution are built-in features.
- API surface for defining reusable database blocks vs. one-off query tasks.
Package facts
| License | Apache License 2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — sqlalchemy, prefect |
| Maintenance | actively maintained — 183 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 940,537/month — #4,680 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: prefect_sqlalchemy-0.6.1-py3-none-any.whl
Keywords: prefect
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
prefect-snowflakePrefect integration that provides tasks and…
permissive · top 15,000 on PyPI
prefect-redisIntegrates Prefect workflow orchestration with…
permissive · top 15,000 on PyPI
prefect-gitlabIntegrates Prefect workflow orchestration with…
permissive · top 15,000 on PyPI
prefect-githubProvides Prefect workflow tasks and blocks for…
permissive · top 5,000 on PyPI
prefectPrefect is a Python workflow orchestration…
permissive · top 5,000 on PyPI
prefect-dbtPrefect integration that orchestrates dbt…
permissive · top 15,000 on PyPI
prefect-daskIntegrates Prefect workflow orchestration with…
permissive · top 15,000 on PyPI
prefect-emailProvides Prefect workflow integration for…
permissive · top 15,000 on PyPI
prefect-slackProvides prebuilt Prefect tasks and blocks to…
permissive · top 15,000 on PyPI
prefect-awsProvides pre-built blocks, tasks, and workers…
permissive · top 5,000 on PyPI