SQLAlchemy Adapter
Work in progress, see #277.
Notes:
- When receiving an sqlalchemy orm instance back from pyamf and you want to save the update,
then you need to merge the object back in to the session. This is done by:
session.merge(my_instance)
see: http://www.sqlalchemy.org/docs/05/session.html#unitofwork_using_merging
- Always add all SqlAlchemy? ORM classes to pyamf using register_class. Otherwise
the following exception can occur:
Traceback (most recent call last): File "test_sqlalchemy.py", line 83, in test_sa_lazy_load user = decoder.readElement() File "pyamf/__init__.py", line 485, in readElement return func() File "pyamf/amf3.py", line 1125, in readObject setattr(obj, k, v) File "sqlalchemy/orm/attributes.py", line 116, in __set__ self.impl.set(instance_state(instance), value, None) File "sqlalchemy/orm/attributes.py", line 619, in set lambda adapter, i: adapter.adapt_like_to_iterable(i)) File "sqlalchemy/orm/attributes.py", line 652, in _set_iterable collections.bulk_replace(new_values, old_collection, new_collection) File "sqlalchemy/orm/collections.py", line 643, in bulk_replace constants = idset(existing_adapter or ()).intersection(values or ()) File "sqlalchemy/util.py", line 978, in intersection self._working_set(self._members.iteritems()).intersection(_iter_id(iterable))) TypeError: dict objects are unhashable
