with significant (~90%) runtime mapper.py call count reduction
in heavily polymorphic mapping configurations.
+ - mapper _get_col_to_prop private method used
+ by the versioning example is deprecated;
+ now use mapper.get_property_by_column() which
+ will remain the public method for this.
+
- sql
- Added basic math expression coercion for
Numeric->Integer,
# mapped column. this will allow usage of MapperProperties
# that have a different keyname than that of the mapped column.
try:
- prop = obj_mapper._get_col_to_prop(obj_col)
+ prop = obj_mapper.get_property_by_column(obj_col)
except UnmappedColumnError:
# in the case of single table inheritance, there may be
# columns on the mapped table intended for the subclass only.
elif u:
attr[hist_col.key] = u[0]
else:
- raise Exception("TODO: what makes us arrive here ?")
+ assert False, "Attribute had no previous state. "\
+ "This indicates active_history isn't "\
+ "working as expected."
if not obj_changed and not deleted:
return
"Mapper '%s' has no property '%s'" % (self, key))
else:
return None
+
+ @util.deprecated('0.7',
+ 'Call to deprecated function mapper._get_col_to_pr'
+ 'op(). Use mapper.get_property_by_column()')
+ def _get_col_to_prop(self, col):
+ return self._columntoproperty[col]
+
+ def get_property_by_column(self, column):
+ """Given a :class:`.Column` object, return the
+ :class:`.MapperProperty` which maps this column."""
+ return self._columntoproperty[column]
+
@property
def iterate_properties(self):
"""return an iterator of all MapperProperty objects."""
verbiage emitted by the sqlalchemy.util.deprecated decorator.
"""
+
def decorate(fn):
def safe(*args, **kw):
# todo: should probably be strict about this, too