Sophie

Sophie

distrib > Fedora > 20 > i386 > by-pkgid > 05d9cf179789e23021b5913b4cd77ca6 > files > 677

python3-sqlalchemy-0.8.7-1.fc20.i686.rpm

"""
Illustrates various methods of associating multiple types of
parents with a particular child object.

The examples all use the declarative extension along with
declarative mixins.   Each one presents the identical use
case at the end - two classes, ``Customer`` and ``Supplier``, both
subclassing the ``HasAddresses`` mixin, which ensures that the
parent class is provided with an ``addresses`` collection
which contains ``Address`` objects.

The configurations include:

* ``table_per_related.py`` - illustrates a distinct table per related collection.
* ``table_per_association.py`` - illustrates a shared collection table, using a
  table per association.
* ``discriminator_on_association.py`` - shared collection table and shared
  association table, including a discriminator column.
* ``generic_fk.py`` - imitates the approach taken by popular frameworks such
  as Django and Ruby on Rails to create a so-called "generic foreign key".

The ``discriminator_on_association.py`` and ``generic_fk.py`` scripts
are modernized versions of recipes presented in the 2007 blog post
`Polymorphic Associations with SQLAlchemy <http://techspot.zzzeek.org/2007/05/29/polymorphic-associations-with-sqlalchemy/>`_.
.

"""