summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/declarative/api.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2020-03-07 19:17:07 +0100
committerMike Bayer <mike_mp@zzzcomputing.com>2020-03-07 17:50:45 -0500
commiteda6dbbf387def2063d1b6719b64b20f9e7f2ab4 (patch)
tree4af5f41edfac169b0fdc6d6cab0fce4e8bf776cf /lib/sqlalchemy/ext/declarative/api.py
parent851fb8f5a661c66ee76308181118369c8c4df9e0 (diff)
downloadsqlalchemy-eda6dbbf387def2063d1b6719b64b20f9e7f2ab4.tar.gz
Simplified module pre-loading strategy and made it linter friendly
Introduced a modules registry to register modules that should be lazily loaded in the package init. This ensures that they are in the system module cache, avoiding potential thread safety issues as when importing them directly in the function that uses them. The module registry is used to obtain these modules directly, ensuring that the all the lazily loaded modules are resolved at the proper time This replaces dependency_for decorator and the dependencies decorator logic, removing the need to pass the resolved modules as arguments of the decodated functions and removes possible errors caused by linters. Fixes: #4689 Fixes: #4656 Change-Id: I2e291eba4297867fc0ddb5d875b9f7af34751d01
Diffstat (limited to 'lib/sqlalchemy/ext/declarative/api.py')
-rw-r--r--lib/sqlalchemy/ext/declarative/api.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ext/declarative/api.py b/lib/sqlalchemy/ext/declarative/api.py
index c8695b7bf..ca7d3a022 100644
--- a/lib/sqlalchemy/ext/declarative/api.py
+++ b/lib/sqlalchemy/ext/declarative/api.py
@@ -23,7 +23,7 @@ from ...orm import attributes
from ...orm import comparable_property
from ...orm import exc as orm_exc
from ...orm import interfaces
-from ...orm import properties
+from ...orm import relationships
from ...orm import synonym as _orm_synonym
from ...orm.base import _inspect_mapped_class
from ...orm.base import _mapper_or_none
@@ -761,7 +761,7 @@ class DeferredReflection(object):
metadata = mapper.class_.metadata
for rel in mapper._props.values():
if (
- isinstance(rel, properties.RelationshipProperty)
+ isinstance(rel, relationships.RelationshipProperty)
and rel.secondary is not None
):
if isinstance(rel.secondary, Table):