summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/mapper.py2
-rw-r--r--lib/sqlalchemy/orm/sync.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py
index 84ff75a79..9a4fd68cb 100644
--- a/lib/sqlalchemy/orm/mapper.py
+++ b/lib/sqlalchemy/orm/mapper.py
@@ -895,6 +895,8 @@ class Mapper(object):
mapper._postfetch(connection, table, obj, c, c.last_inserted_params())
# synchronize newly inserted ids from one table to the next
+ # TODO: this fires off more than needed, try to organize syncrules
+ # per table
def sync(mapper):
inherit = mapper.inherits
if inherit is not None:
diff --git a/lib/sqlalchemy/orm/sync.py b/lib/sqlalchemy/orm/sync.py
index c43bd69e0..91def7361 100644
--- a/lib/sqlalchemy/orm/sync.py
+++ b/lib/sqlalchemy/orm/sync.py
@@ -9,6 +9,8 @@
import sqlalchemy.sql as sql
import sqlalchemy.schema as schema
from sqlalchemy.exceptions import *
+from sqlalchemy import logging
+import util as mapperutil
"""contains the ClauseSynchronizer class, which is used to map attributes between two objects
in a manner corresponding to a SQL clause that compares column values."""
@@ -121,8 +123,11 @@ class SyncRule(object):
if isinstance(dest, dict):
dest[self.dest_column.key] = value
else:
- #print "SYNC VALUE", value, "TO", dest, self.source_column, self.dest_column
+ if logging.is_debug_enabled(self.logger):
+ self.logger.debug("execute() instances: %s(%s)->%s(%s) ('%s')" % (mapperutil.instance_str(source), str(self.source_column), mapperutil.instance_str(dest), str(self.dest_column), value))
self.dest_mapper._setattrbycolumn(dest, self.dest_column, value)
+
+SyncRule.logger = logging.class_logger(SyncRule)
class BinaryVisitor(sql.ClauseVisitor):
def __init__(self, func):