]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- ensure that sqlalchemy.ext is set up for importlater
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 27 Apr 2017 18:33:54 +0000 (14:33 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 27 Apr 2017 18:33:54 +0000 (14:33 -0400)
otherwise, it fails if you import from ext before orm:

    from sqlalchemy import *
    from sqlalchemy.ext.declarative import declarative_base
    from sqlalchemy.orm import *

and then do a lazyload, as the ext.baked importlater is not
initialized.

Change-Id: I24dcbfc9ca9022316da28507772562833e45dd95

lib/sqlalchemy/orm/__init__.py
lib/sqlalchemy/orm/strategies.py

index 8d46324e8e29a80be5c5d38fff073a4d37c75527..adfe2360a8e2b1db4a888849e73b069b1bf9a89d 100644 (file)
@@ -274,5 +274,6 @@ def __go(lcls):
                      if not (name.startswith('_') or _inspect.ismodule(obj)))
 
     _sa_util.dependencies.resolve_all("sqlalchemy.orm")
+    _sa_util.dependencies.resolve_all("sqlalchemy.ext")
 
 __go(locals())
index ddf5397fd3e213c7823813bf6e5cdd85d21b259a..00aabed0bb0fb2d41af9a6414c944b0cc87d6857 100644 (file)
@@ -596,7 +596,6 @@ class LazyLoader(AbstractRelationshipLoader, util.MemoizedSlots):
         "sqlalchemy.orm.strategy_options")
     def _emit_lazyload(
             self, strategy_options, session, state, ident_key, passive):
-
         # emit lazy load now using BakedQuery, to cut way down on the overhead
         # of generating queries.
         # there are two big things we are trying to guard against here: