SQLAlchemy 2.0 Future (Core) — SQLAlchemy 2.0.0b1 documentation

From Get docs
Sqlalchemy/docs/latest/core/future

SQLAlchemy 2.0 Future (Core)

This package includes a relatively small number of transitional elements to allow “2.0 mode” to take place within SQLAlchemy 1.4. The primary objects provided here are _future.Engine and _future.Connection, which are both subclasses of the existing _engine.Engine and _engine.Connection objects with essentially a smaller set of methods and the removal of “autocommit”.

Within the 1.4 series, the “2.0” style of engines and connections is enabled by passing the :paramref:`_sa.create_engine.future` flag to _sa.create_engine():

from sqlalchemy import create_engine
engine = create_engine("postgresql://user:[email protected]/dbname", future=True)

Similarly, with the ORM, to enable “future” behavior in the ORM Session, pass the :paramref:`_orm.Session.future` parameter either to the Session constructor directly, or via the _orm.sessionmaker class:

from sqlalchemy.orm import sessionmaker

Session = sessionmaker(engine, future=True)

See also

Migrating to SQLAlchemy 2.0 - Introduction to the 2.0 series of SQLAlchemy