11/16/2022, 10:43 AM
Hi everyone, we are migrating from prefect 1 to prefect 2, in our previous flows we are using sqlalchemy ORM to run queries on our database, would you recommend to switch to the prefect-sqlalchemy library and use plain SQL? (edite

Ryan Peden

11/16/2022, 2:59 PM
It depends on what is best for your workflow. If you're already using objects with SQLAlchemy and performance is good enough for your needs, switching to plain SQL might just add extra work for you without providing much benefit. If you're already using SQLAlchemy with objects and you want to re-use as much of your code as possible, you could use `prefect-sqlchemy`'s DatabaseCredentials class (specifically the
method) as an easy way to initialize SQLAlchemy. Then you can just use the SQLAlchemy engine the same way you normally would.