skillfed

prefect-sqlalchemy

Prefect integrations for working with databases

prefect-sqlalchemy v0.6.1 940.5K downloads/30d#4,680 on PyPI23,623
Permissive license Apache License 2.0 Active released

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-sqlalchemy

uv

uv add prefect-sqlalchemy

poetry

poetry add prefect-sqlalchemy

Installing 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

Intended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Software Development :: Libraries

Tags

prefect database integrationsqlalchemy prefect tasksdatabase workflow orchestrationprefect sql blockssqlalchemy prefect blocksdatabase task automationprefect database connections
workflow-orchestrationdatabase-integrationetl

More Libraries packages