Introduction
SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL.
PyAMF 0.4 and newer includes an adapter for decoding/encoding objects managed by SQLAlchemy. The adapter is enabled by default, and SQLAlchemy managed objects are transparently encoded/decoded by the adapter.
To use the adapter, make sure any SQLAlchemy managed classes are mapped BEFORE assigning an AMF alias for the class.
# MUST COME FIRST
sqlalchemy.orm.mapper(MappedClass, mapped_table)
# MUST COME LATER
pyamf.register_class(MappedClass, 'mapped_class_alias')
The adapter adds 2 additional attributes to all encoded objects that are managed by SQLAlchemy.
encoded object (analogous to mapper.primary_key_from_instance(obj) in Python)
loaded from the database
The additional information contained in these attributes can be used to lazy load attributes in the client.