summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/mapper.py
diff options
context:
space:
mode:
authorjonathan vanasco <jonathan@2xlp.com>2021-11-12 12:45:54 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2023-01-24 22:03:06 -0500
commit03212e5aefb3d5c912d25274f447eb9c493f7268 (patch)
treefdf6b7919dab70e979304f43b6fbde9b8ad6515b /lib/sqlalchemy/orm/mapper.py
parent55b243a3f22f267c829f9088fd4e801f0b621a31 (diff)
downloadsqlalchemy-03212e5aefb3d5c912d25274f447eb9c493f7268.tar.gz
add context for warnings emitted from configure_mappers(), autoflush()
Improved the notification of warnings that are emitted within the configure mappers or flush process, which are often invoked as part of a different operation, to add additional context to the message that indicates one of these operations as the source of the warning within operations that may not be obviously related. Fixes: #7305 Change-Id: I79da7a6a5d4cf67d57615d0ffc2b8d8454011c84
Diffstat (limited to 'lib/sqlalchemy/orm/mapper.py')
-rw-r--r--lib/sqlalchemy/orm/mapper.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py
index 141b5c27a..dd3aef8d6 100644
--- a/lib/sqlalchemy/orm/mapper.py
+++ b/lib/sqlalchemy/orm/mapper.py
@@ -2311,6 +2311,12 @@ class Mapper(
"columns get mapped." % (key, self, column.key, prop)
)
+ @util.langhelpers.tag_method_for_warnings(
+ "This warning originated from the `configure_mappers()` process, "
+ "which was invoked automatically in response to a user-initiated "
+ "operation.",
+ sa_exc.SAWarning,
+ )
def _check_configure(self) -> None:
if self.registry._new_mappers:
_configure_registries({self.registry}, cascade=True)