From ae26007d52caab1575a9aef4fecb90785f7e118d Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Wed, 8 Apr 2020 19:19:02 +0200 Subject: [PATCH] Change ``orm.future`` to ``future.orm`` Change-Id: I7fcf8b691134a0c52fbbf7879da071a41ec28102 --- doc/build/changelog/migration_20.rst | 16 ++++++++-------- doc/build/errors.rst | 2 +- lib/sqlalchemy/future/__init__.py | 2 +- lib/sqlalchemy/future/orm/__init__.py | 10 ++++++++++ 4 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 lib/sqlalchemy/future/orm/__init__.py diff --git a/doc/build/changelog/migration_20.rst b/doc/build/changelog/migration_20.rst index 501a16c559..77b4e34af6 100644 --- a/doc/build/changelog/migration_20.rst +++ b/doc/build/changelog/migration_20.rst @@ -93,14 +93,14 @@ The steps to achieve this are as follows: * APIs which are explicitly incompatible with SQLAlchemy 1.x style will be available in two new packages ``sqlalchemy.future`` and - ``sqlalchemy.orm.future``. The most prominent objects in these new packages + ``sqlalchemy.future.orm``. The most prominent objects in these new packages will be the :func:`sqlalchemy.future.select` object, which now features a refined constructor, and additionally will be compatible with ORM querying, as well as the new declarative base construct in - ``sqlalchemy.orm.future``. + ``sqlalchemy.future.orm``. * SQLAlchemy 2.0 will include the same ``sqlalchemy.future`` and - ``sqlalchemy.orm.future`` packages; once an application only needs to run on + ``sqlalchemy.future.orm`` packages; once an application only needs to run on SQLAlchemy 2.0 (as well as Python 3 only of course :) ), the "future" imports can be changed to refer to the canonical import, for example ``from sqlalchemy.future import select`` becomes ``from sqlalchemy import select``. @@ -487,7 +487,7 @@ longer. The signature "in spirit" would be:: The interim signature will be:: # 1.4 / 2.0 using sqlalchemy.future.create_engine, - # sqlalchemy.orm.future.Session / sessionmaker / etc + # sqlalchemy.future.orm.Session / sessionmaker / etc def execute(self, statement, _params=None, **options): @@ -599,7 +599,7 @@ such as ``row["some_column"]`` can be used. In order to receive results as mappings up front, the ``mappings()`` modifier on the result can be used:: - from sqlalchemy.orm.future import Session + from sqlalchemy.future.orm import Session session = Session(some_engine) @@ -634,7 +634,7 @@ Declarative becomes a first class API be integrating the declarative documentation appropriately. Declarative will now be part of ``sqlalchemy.orm`` in 2.0, and in 1.4 the -new version will be present in ``sqlalchemy.orm.future``. The concept +new version will be present in ``sqlalchemy.future.orm``. The concept of the ``Base`` class will be there as it is now and do the same thing it already does, however it will also have some new capabilities. @@ -707,7 +707,7 @@ to where the ``declarative_mapper()`` function was called. However, we can just as easily add the above ``mapper()`` function to any declarative base, to make for a pattern such as:: - from sqlalchemy.orm.future import declarative_base + from sqlalchemy.future.orm import declarative_base base = declarative_base() @@ -769,7 +769,7 @@ then when delivered to the ``.invoke()`` or ``.execute()`` method of from sqlalchemy.future import select stmt = select(User).join(User.addresses).where(Address.email == 'foo@bar.com') - from sqlalchemy.orm.future import Session + from sqlalchemy.future.orm import Session session = Session(some_engine) rows = session.execute(stmt).all() diff --git a/doc/build/errors.rst b/doc/build/errors.rst index be77da3e7e..ed5583b121 100644 --- a/doc/build/errors.rst +++ b/doc/build/errors.rst @@ -58,7 +58,7 @@ warning is at the base of this system to provide guidance on what behaviors in an existing codebase will need to be modified. For some occurrences of this warning, an additional recommendation to use an -API in either the ``sqlalchemy.future`` or ``sqlalchemy.orm.future`` packages +API in either the ``sqlalchemy.future`` or ``sqlalchemy.future.orm`` packages may be present. This refers to two special future-compatibility packages that are part of SQLAlchemy 1.4 and are there to help migrate an application to the 2.0 version. diff --git a/lib/sqlalchemy/future/__init__.py b/lib/sqlalchemy/future/__init__.py index f8836112ec..d38d27d884 100644 --- a/lib/sqlalchemy/future/__init__.py +++ b/lib/sqlalchemy/future/__init__.py @@ -5,7 +5,7 @@ # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -"""Future 2.0 API features for Core. +"""Future 2.0 API features. """ diff --git a/lib/sqlalchemy/future/orm/__init__.py b/lib/sqlalchemy/future/orm/__init__.py new file mode 100644 index 0000000000..56b5dfa463 --- /dev/null +++ b/lib/sqlalchemy/future/orm/__init__.py @@ -0,0 +1,10 @@ +# sql/future/orm/__init__.py +# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors +# +# +# This module is part of SQLAlchemy and is released under +# the MIT License: http://www.opensource.org/licenses/mit-license.php + +"""Future 2.0 API features for Orm. + +""" -- 2.39.5