prefect-sqlalchemy
helps you connect to a database in your Prefect flows.
prefect-sqlalchemy
prefect-sqlalchemy
compatible with your installed version of prefect
.
If you don’t already have prefect
installed, it will install the newest version of prefect
as well.
prefect
and prefect-sqlalchemy
:
prefect-sqlalchemy
module to make them available for use.
load
method on Blocks, you must have a block saved through code or saved through the UI.
driver
and database
arguments:
execute
and execute_many
methods.
Use the fetch_many
method to retrieve data in a stream until there’s no more data.
Use the SqlAlchemyConnector
as a context manager, to ensure that the SQLAlchemy engine and any connected resources are closed properly after you’re done with them.
SqlAlchemyConnector
supports async workflows. Just be sure to save, load, and use an async driver, as in the example below.prefect-sqlalchemy
SDK documentation to explore all the capabilities of the prefect-sqlalchemy
library.
For assistance using SQLAlchemy, consult the SQLAlchemy documentation.