From: Mike Bayer Date: Fri, 14 Oct 2022 13:17:09 +0000 (-0400) Subject: narrow formatting in table, turn format off X-Git-Tag: rel_1_4_42~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d81c792c354f4a01d64bcb44ad3a8c3eeae931d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git narrow formatting in table, turn format off Change-Id: I0824495e0582657ffb63eaa2466021f56005c81c References: https://github.com/sqlalchemy/sqlalchemy/discussions/8157#discussioncomment-3878806 (cherry picked from commit 1985cb0f48b298ffc445b052cd62a8d4a81f4e10) --- diff --git a/doc/build/changelog/migration_10.rst b/doc/build/changelog/migration_10.rst index 2ff8641501..0c5f9187dc 100644 --- a/doc/build/changelog/migration_10.rst +++ b/doc/build/changelog/migration_10.rst @@ -181,7 +181,7 @@ applied:: class MySubClass(MyClass): - """""" + """ """ # ... diff --git a/doc/build/changelog/migration_20.rst b/doc/build/changelog/migration_20.rst index 105108434f..d0d92c0b96 100644 --- a/doc/build/changelog/migration_20.rst +++ b/doc/build/changelog/migration_20.rst @@ -1156,6 +1156,7 @@ calling form with links to documentation for each technique presented. The individual migration notes are in the embedded sections following the table, and may include additional notes not summarized here. +.. format: off .. container:: sliding-table @@ -1182,9 +1183,15 @@ following the table, and may include additional notes not summarized here. - :: - session.execute(select(User)).scalars().all() + session.execute( + select(User) + ).scalars().all() + # or - session.scalars(select(User)).all() + + session.scalars( + select(User) + ).all() - :ref:`migration_20_unify_select` @@ -1193,11 +1200,16 @@ following the table, and may include additional notes not summarized here. * - :: - session.query(User).filter_by(name="some user").one() + session.query(User).\ + filter_by(name="some user").\ + one() - :: - session.execute(select(User).filter_by(name="some user")).scalar_one() + session.execute( + select(User). + filter_by(name="some user") + ).scalar_one() - :ref:`migration_20_unify_select` @@ -1205,11 +1217,17 @@ following the table, and may include additional notes not summarized here. * - :: - session.query(User).filter_by(name="some user").first() + session.query(User).\ + filter_by(name="some user").\ + first() - :: - session.scalars(select(User).filter_by(name="some user").limit(1)).first() + session.scalars( + select(User). + filter_by(name="some user"). + limit(1) + ).first() - :ref:`migration_20_unify_select` @@ -1217,22 +1235,38 @@ following the table, and may include additional notes not summarized here. * - :: - session.query(User).options(joinedload(User.addresses)).all() + session.query(User).options( + joinedload(User.addresses) + ).all() - :: - session.scalars(select(User).options(joinedload(User.addresses))).unique().all() + session.scalars( + select(User). + options( + joinedload(User.addresses) + ) + ).unique().all() - :ref:`joinedload_not_uniqued` * - :: - session.query(User).join(Address).filter(Address.email == "e@sa.us").all() + session.query(User).\ + join(Address).\ + filter( + Address.email == "e@sa.us" + ).\ + all() - :: session.execute( - select(User).join(Address).where(Address.email == "e@sa.us") + select(User). + join(Address). + where( + Address.email == "e@sa.us" + ) ).scalars().all() - :ref:`migration_20_unify_select` @@ -1241,27 +1275,43 @@ following the table, and may include additional notes not summarized here. * - :: - session.query(User).from_statement(text("select * from users")).all() + session.query(User).\ + from_statement( + text("select * from users") + ).\ + all() - :: - session.scalars(select(User).from_statement(text("select * from users"))).all() + session.scalars( + select(User). + from_statement( + text("select * from users") + ) + ).all() - :ref:`orm_queryguide_selecting_text` * - :: - session.query(User).join(User.addresses).options( + session.query(User).\ + join(User.addresses).\ + options( contains_eager(User.addresses) - ).populate_existing().all() + ).\ + populate_existing().all() - :: session.execute( - select(User) - .join(User.addresses) - .options(contains_eager(User.addresses)) - .execution_options(populate_existing=True) + select(User) + .join(User.addresses) + .options( + contains_eager(User.addresses) + ) + .execution_options( + populate_existing=True + ) ).scalars().all() - @@ -1273,17 +1323,22 @@ following the table, and may include additional notes not summarized here. * - :: - session.query(User).filter(User.name == "foo").update( - {"fullname": "Foo Bar"}, synchronize_session="evaluate" - ) + session.query(User).\ + filter(User.name == "foo").\ + update( + {"fullname": "Foo Bar"}, + synchronize_session="evaluate" + ) - :: session.execute( - update(User) - .where(User.name == "foo") - .values(fullname="Foo Bar") - .execution_options(synchronize_session="evaluate") + update(User) + .where(User.name == "foo") + .values(fullname="Foo Bar") + .execution_options( + synchronize_session="evaluate" + ) ) - :ref:`orm_expression_update_delete` @@ -1295,11 +1350,18 @@ following the table, and may include additional notes not summarized here. - :: - session.scalar(select(func.count()).select_from(User)) - session.scalar(select(func.count(User.id))) + session.scalar( + select(func.count()). + select_from(User) + ) + session.scalar( + select(func.count(User.id)) + ) - :meth:`_orm.Session.scalar` +.. format: on + .. _migration_20_unify_select: ORM Query Unified with Core Select diff --git a/doc/build/orm/declarative_config.rst b/doc/build/orm/declarative_config.rst index 3a811ed82e..9f031bd6e1 100644 --- a/doc/build/orm/declarative_config.rst +++ b/doc/build/orm/declarative_config.rst @@ -320,7 +320,7 @@ assumed to be completed and the 'configure' step has finished:: class MyClass(Base): @classmethod def __declare_last__(cls): - """""" + """ """ # do something with mappings ``__declare_first__()`` @@ -332,7 +332,7 @@ configuration via the :meth:`.MapperEvents.before_configured` event:: class MyClass(Base): @classmethod def __declare_first__(cls): - """""" + """ """ # do something before mappings are configured .. versionadded:: 0.9.3 @@ -423,7 +423,7 @@ subclasses to extend just from the special class:: __abstract__ = True def some_helpful_method(self): - """""" + """ """ @declared_attr def __mapper_args__(cls):