From: Mike Bayer Date: Thu, 13 Oct 2022 13:12:04 +0000 (-0400) Subject: fixes for doc builds X-Git-Tag: rel_2_0_0b1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfd5b3e78fdd58174ba8f107412851938524ca1c;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git fixes for doc builds * requirements needs typing_extensions * update all "future=True" references to be appropriate to 2.0 Change-Id: I2eeb0ae65afdb587f21aeb0020f1d8a292f67c21 --- diff --git a/doc/build/conf.py b/doc/build/conf.py index 7abdd45e2e..7d1a4d4456 100644 --- a/doc/build/conf.py +++ b/doc/build/conf.py @@ -109,7 +109,7 @@ changelog_render_pullreq = { changelog_render_changeset = "https://www.sqlalchemy.org/trac/changeset/%s" -exclude_patterns = ["build", "**/unreleased*/*", "**/*_include.rst"] +exclude_patterns = ["build", "**/unreleased*/*", "**/*_include.rst", ".venv"] autodoc_class_signature = "separated" diff --git a/doc/build/core/operators.rst b/doc/build/core/operators.rst index dde977c9ea..9bf47ec669 100644 --- a/doc/build/core/operators.rst +++ b/doc/build/core/operators.rst @@ -5,7 +5,7 @@ Operator Reference >>> from sqlalchemy import column, select >>> from sqlalchemy import create_engine - >>> engine = create_engine("sqlite+pysqlite:///:memory:", echo=True, future=True) + >>> engine = create_engine("sqlite+pysqlite:///:memory:", echo=True) >>> from sqlalchemy import MetaData, Table, Column, Integer, String, Numeric >>> metadata_obj = MetaData() >>> user_table = Table( diff --git a/doc/build/faq/ormconfiguration.rst b/doc/build/faq/ormconfiguration.rst index d3c9dba85d..3ff3c93b80 100644 --- a/doc/build/faq/ormconfiguration.rst +++ b/doc/build/faq/ormconfiguration.rst @@ -347,4 +347,4 @@ loads directly to primary key values just loaded. .. seealso:: - :ref:`subqueryload_ordering` + :ref:`subquery_eager_loading` diff --git a/doc/build/orm/session_events.rst b/doc/build/orm/session_events.rst index b502191e57..980e301d13 100644 --- a/doc/build/orm/session_events.rst +++ b/doc/build/orm/session_events.rst @@ -45,7 +45,7 @@ interception of a query, which includes those emitted by provides accessors to allow modifications to statements, parameters, and options:: - Session = sessionmaker(engine, future=True) + Session = sessionmaker(engine) @event.listens_for(Session, "do_orm_execute") @@ -84,7 +84,7 @@ may be used on its own, or is ideally suited to be used within the from sqlalchemy.orm import with_loader_criteria - Session = sessionmaker(engine, future=True) + Session = sessionmaker(engine) @event.listens_for(Session, "do_orm_execute") diff --git a/doc/build/orm/session_transaction.rst b/doc/build/orm/session_transaction.rst index be45906709..aca558d6ff 100644 --- a/doc/build/orm/session_transaction.rst +++ b/doc/build/orm/session_transaction.rst @@ -221,21 +221,16 @@ without the need for refreshing it from the database. Session-level vs. Engine level transaction control -------------------------------------------------- -As of SQLAlchemy 1.4, the :class:`_orm.sessionmaker` and Core -:class:`_engine.Engine` objects both support :term:`2.0 style` operation, -by making use of the :paramref:`_orm.Session.future` flag as well as the -:paramref:`_engine.create_engine.future` flag so that these two objects -assume 2.0-style semantics. - -When using future mode, there should be equivalent semantics between -the two packages, at the level of the :class:`_orm.sessionmaker` vs. +The :class:`_engine.Connection` in Core and +:class:`_session.Session` in ORM feature equivalent transactional +semantics, both at the level of the :class:`_orm.sessionmaker` vs. the :class:`_engine.Engine`, as well as the :class:`_orm.Session` vs. the :class:`_engine.Connection`. The following sections detail these scenarios based on the following scheme: .. sourcecode:: text - ORM (using future Session) Core (using future engine) + ORM Core ----------------------------------------- ----------------------------------- sessionmaker Engine Session Connection @@ -297,7 +292,7 @@ that will maintain a begin/commit/rollback context for that object. Engine:: - engine = create_engine("postgresql+psycopg2://user:pass@host/dbname", future=True) + engine = create_engine("postgresql+psycopg2://user:pass@host/dbname") with engine.begin() as conn: conn.execute( @@ -312,7 +307,7 @@ Engine:: Session:: - Session = sessionmaker(engine, future=True) + Session = sessionmaker(engine) with Session.begin() as session: session.add_all( @@ -336,7 +331,7 @@ specific behavior that is reversed from the 1.x series. Engine:: - engine = create_engine("postgresql+psycopg2://user:pass@host/dbname", future=True) + engine = create_engine("postgresql+psycopg2://user:pass@host/dbname") with engine.begin() as conn: savepoint = conn.begin_nested() @@ -354,7 +349,7 @@ Engine:: Session:: - Session = sessionmaker(engine, future=True) + Session = sessionmaker(engine) with Session.begin() as session: savepoint = session.begin_nested() diff --git a/doc/build/requirements.txt b/doc/build/requirements.txt index 38511e579d..eccea8b182 100644 --- a/doc/build/requirements.txt +++ b/doc/build/requirements.txt @@ -3,3 +3,4 @@ git+https://github.com/sqlalchemyorg/sphinx-paramlinks.git#egg=sphinx-paramlinks git+https://github.com/sqlalchemyorg/zzzeeksphinx.git#egg=zzzeeksphinx sphinx-copybutton sphinx-autobuild +typing-extensions diff --git a/doc/build/tutorial/dbapi_transactions.rst b/doc/build/tutorial/dbapi_transactions.rst index 68fc84bcbc..00178936b0 100644 --- a/doc/build/tutorial/dbapi_transactions.rst +++ b/doc/build/tutorial/dbapi_transactions.rst @@ -391,7 +391,7 @@ for many rows while still supporting RETURNING. .. seealso:: - :term:`executemany` - in the :doc:`Glossary `, describes the + :term:`executemany` - in the :doc:`Glossary `, describes the DBAPI-level `cursor.executemany() `_ method that's used for most "executemany" executions. diff --git a/doc/build/tutorial/engine.rst b/doc/build/tutorial/engine.rst index e42d67a022..80c20e566e 100644 --- a/doc/build/tutorial/engine.rst +++ b/doc/build/tutorial/engine.rst @@ -19,14 +19,13 @@ which will describe how it should connect to the database host or backend. For this tutorial we will use an in-memory-only SQLite database. This is an easy way to test things without needing to have an actual pre-existing database -set up. The :class:`_engine.Engine` is created by using :func:`_sa.create_engine`, specifying -the :paramref:`_sa.create_engine.future` flag set to ``True`` so that we make full use -of :term:`2.0 style` usage: +set up. The :class:`_engine.Engine` is created by using the +:func:`_sa.create_engine` function: .. sourcecode:: pycon+sql >>> from sqlalchemy import create_engine - >>> engine = create_engine("sqlite+pysqlite:///:memory:", echo=True, future=True) + >>> engine = create_engine("sqlite+pysqlite:///:memory:", echo=True) The main argument to :class:`_sa.create_engine` is a string URL, above passed as the string ``"sqlite+pysqlite:///:memory:"``. diff --git a/examples/extending_query/filter_public.py b/examples/extending_query/filter_public.py index 08a0d273db..a420e9da4a 100644 --- a/examples/extending_query/filter_public.py +++ b/examples/extending_query/filter_public.py @@ -85,7 +85,7 @@ if __name__ == "__main__": engine = create_engine("sqlite://", echo=True) Base.metadata.create_all(engine) - Session = sessionmaker(bind=engine, future=True) + Session = sessionmaker(bind=engine) sess = Session() diff --git a/examples/extending_query/temporal_range.py b/examples/extending_query/temporal_range.py index 3a6570ad1e..01d0eadf87 100644 --- a/examples/extending_query/temporal_range.py +++ b/examples/extending_query/temporal_range.py @@ -50,7 +50,7 @@ if __name__ == "__main__": engine = create_engine("sqlite://", echo=True) Base.metadata.create_all(engine) - Session = sessionmaker(bind=engine, future=True) + Session = sessionmaker(bind=engine) sess = Session() diff --git a/examples/sharding/separate_databases.py b/examples/sharding/separate_databases.py index 9818656c3c..a45182f42d 100644 --- a/examples/sharding/separate_databases.py +++ b/examples/sharding/separate_databases.py @@ -31,7 +31,6 @@ db4 = create_engine("sqlite://", echo=echo) # to databases within a ShardedSession and returns it. Session = sessionmaker( class_=ShardedSession, - future=True, shards={ "north_america": db1, "asia": db2, diff --git a/examples/sharding/separate_schema_translates.py b/examples/sharding/separate_schema_translates.py index c4f2b9e25c..2d4c2a0464 100644 --- a/examples/sharding/separate_schema_translates.py +++ b/examples/sharding/separate_schema_translates.py @@ -45,7 +45,6 @@ db4 = engine.execution_options(schema_translate_map={None: "schema_4"}) # to databases within a ShardedSession and returns it. Session = sessionmaker( class_=ShardedSession, - future=True, shards={ "north_america": db1, "asia": db2, diff --git a/examples/sharding/separate_tables.py b/examples/sharding/separate_tables.py index 0f6e2ffd83..8f39471e88 100644 --- a/examples/sharding/separate_tables.py +++ b/examples/sharding/separate_tables.py @@ -45,7 +45,6 @@ def before_cursor_execute( # to databases within a ShardedSession and returns it. Session = sessionmaker( class_=ShardedSession, - future=True, shards={ "north_america": db1, "asia": db2,