]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
document placement of declarative init method
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 10 Sep 2021 13:42:11 +0000 (09:42 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 10 Sep 2021 13:42:11 +0000 (09:42 -0400)
Fixes: #7013
Fixes: #7015
Change-Id: Iba7eb8aeb37cec08e1bd1edcf28e05b02004afe7

doc/build/orm/mapping_styles.rst
lib/sqlalchemy/orm/decl_api.py

index 31f5abdf3c866ccfb82913a49a8cb4683f09c1d7..e643cfce63394ab17bbceda6ee96b61017de18a5 100644 (file)
@@ -131,6 +131,8 @@ be produced in a fully explicit fashion using the
         registry = mapper_registry
         metadata = mapper_registry.metadata
 
+        __init__ = mapper_registry.constructor
+
 The above ``Base`` is equivalent to one created using the
 :meth:`_orm.registry.generate_base` method and will be fully understood by
 type analysis tools without the use of plugins.
index 23b89a5434b0fe0d48ab384dde458e0df3ee5edc..1b35f07286b5b33d8824b53a0891c7237e21599c 100644 (file)
@@ -761,6 +761,8 @@ class registry(object):
                 registry = mapper_registry
                 metadata = mapper_registry.metadata
 
+                __init__ = mapper_registry.constructor
+
         The :meth:`_orm.registry.generate_base` method provides the
         implementation for the :func:`_orm.declarative_base` function, which
         creates the :class:`_orm.registry` and base class all at once.