Module Expr Str ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr If CompareIs NameLoad NameLoad body Return NameLoad orelse Return Call NameLoad NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call NameLoad NameLoad Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign AttributeStore NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Expr Call NameLoad NameLoad NameLoad NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore ListComp TupleLoad Call NameLoad BinOpMod Str NameLoad Call NameLoad Call NameLoad AttributeLoad NameLoad attr NameLoad NameLoad comprehension TupleStore NameStore NameStore NameLoad CompareIsNot NameLoad NameLoad Return Call NameLoad NameLoad AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return CompareEq Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return CompareNotEq Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad decorator_list decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Return BinOpMod Str TupleLoad AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Dict Assign SubscriptStore NameLoad Index Call NameLoad NameLoad TupleLoad NameLoad Str Assign SubscriptStore NameLoad Index Str TupleLoad NameLoad Str For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad If CompareIn Str AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore SubscriptLoad AttributeLoad NameLoad attr Index Str Assign SubscriptStore NameLoad Index NameLoad TupleLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad TupleLoad NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list Call AttributeLoad NameLoad attr NameLoad Str keyword NameLoad If CompareEq NameLoad Str body ImportFrom alias alias alias alias alias alias alias alias alias alias alias alias alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore Call NameLoad ClassDef bases NameLoad NameLoad body Expr Str Assign NameStore Str Assign NameStore Call NameLoad Call NameLoad Str keyword NameLoad Assign NameStore Call NameLoad Call NameLoad Num keyword NameLoad Assign NameStore Call NameLoad Call NameLoad Num Assign NameStore Call NameLoad NameLoad keyword Dict Str TupleLoad NameLoad Str Assign NameStore Call NameLoad NameLoad keyword Dict Str TupleLoad NameLoad Str Assign NameStore Call NameLoad NameLoad keyword Dict Str TupleLoad NameLoad Str decorator_list ClassDef bases Call AttributeLoad NameLoad attr NameLoad body Expr Str Assign NameStore Str Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign NameStore Call NameLoad Call NameLoad Num Assign NameStore Call NameLoad Str keyword Call NameLoad Str Assign NameStore Call NameLoad Str Str keyword Lambda arguments args NameParam NameParam defaults Call NameLoad keyword NameLoad keyword NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad keyword NameLoad decorator_list NameLoad decorator_list Assign NameStore Call NameLoad Str keyword NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad Str Assign SubscriptStore NameLoad Index Str Str Assign SubscriptStore NameLoad Index Str Num Assign SubscriptStore NameLoad Index Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr CompareEq AttributeLoad NameLoad attr Str attr Print SubscriptLoad NameLoad Index Str Print SubscriptLoad NameLoad Index Str Print Str Assign SubscriptStore NameLoad Index Str Str Expr Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad Str Assign SubscriptStore NameLoad Index Str Num Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad Str Assign SubscriptStore NameLoad Index Str Num Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad CompareEq AttributeLoad NameLoad attr Str CompareEq AttributeLoad NameLoad attr NameLoad Print TupleLoad Str Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Call AttributeLoad NameLoad attr Str NameLoad Print TupleLoad Str Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Call AttributeLoad NameLoad attr Str NameLoad Print TupleLoad Str Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr Str NameLoad UnaryOpInvert Call AttributeLoad AttributeLoad NameLoad attr attr CompareEq AttributeLoad NameLoad attr Str Print TupleLoad Str Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr CompareEq AttributeLoad NameLoad attr Num Print TupleLoad Str Call AttributeLoad NameLoad attr
N/A N/A Mapping a polymorphic-valued vertical table as a dictionary.

Builds upon the dictlike.py example to also add differently typed
columns to the "fact" table, e.g.::

  Table('properties', metadata
        Column('owner_id', Integer, ForeignKey('owner.id'),
               primary_key=True),
        Column('key', UnicodeText),
        Column('type', Unicode(16)),
        Column('int_value', Integer),
        Column('char_value', UnicodeText),
        Column('bool_value', Boolean),
        Column('decimal_value', Numeric(10,2)))

For any given properties row, the value of the 'type' column will point to the
'_value' column active for that row.

This example approach uses exactly the same dict mapping approach as the
'dictlike' example.  It only differs in the mapping for vertical rows.  Here,
we'll use a @hybrid_property to build a smart '.value' attribute that wraps up
reading and writing those various '_value' columns and keeps the '.type' up to
date.

 sqlalchemy.orm.interfaces PropComparator sqlalchemy.ext.hybrid hybrid_property sqlalchemy event sqlalchemy literal_column dictlike ProxiedDictMixin PolymorphicVerticalProperty N/A object N/A N/A A key/value pair with polymorphic value storage.

    The class which is mapped should indicate typing information
    within the "info" dictionary of mapped Column objects; see
    the AnimalFact mapping below for an example.

     __init__ N/A N/A self key value N/A None N/A N/A N/A self key key N/A N/A self value value N/A value N/A N/A self N/A N/A N/A N/A fieldname discriminator N/A N/A self type_map N/A N/A self type N/A N/A fieldname None N/A N/A None N/A N/A N/A getattr self fieldname N/A hybrid_property value N/A N/A self value N/A N/A N/A py_type N/A type value N/A N/A fieldname discriminator N/A N/A self type_map N/A py_type N/A N/A self type discriminator N/A N/A fieldname None N/A N/A N/A setattr self fieldname value N/A N/A value setter value N/A N/A self N/A N/A N/A N/A N/A self _set_value None N/A N/A value deleter value N/A PropComparator N/A N/A A comparator for .value, builds a polymorphic comparison via CASE.

         __init__ N/A N/A self cls N/A N/A N/A N/A self cls cls N/A _case N/A N/A self N/A N/A N/A pairs N/A set N/A N/A N/A N/A self cls type_map values N/A whens N/A N/A N/A literal_column N/A '%s' discriminator N/A cast N/A getattr N/A self cls attribute String N/A N/A attribute discriminator pairs N/A attribute None N/A N/A case whens N/A N/A self cls type N/A null N/A __eq__ N/A N/A self other N/A N/A N/A N/A N/A N/A self _case N/A cast other String N/A __ne__ N/A N/A self other N/A N/A N/A N/A N/A N/A self _case N/A cast other String N/A N/A N/A value comparator __repr__ N/A N/A self N/A N/A N/A N/A <%s %r=%r> N/A N/A N/A self __class__ __name__ N/A self key N/A self value N/A N/A on_new_class N/A N/A mapper cls_ N/A N/A N/A Look for Column objects with type info in them, and work up
    a lookup table. N/A info_dict N/A N/A N/A info_dict N/A N/A type None N/A None none N/A N/A info_dict N/A none N/A None none N/A k N/A N/A N/A mapper c keys N/A N/A col N/A N/A mapper c N/A k N/A N/A type N/A col info N/A N/A N/A python_type discriminator N/A N/A col info N/A type N/A N/A info_dict N/A python_type N/A k discriminator N/A N/A info_dict N/A discriminator N/A k discriminator N/A N/A cls_ type_map info_dict N/A N/A N/A event listens_for PolymorphicVerticalProperty mapper_configured propagate True N/A N/A __name__ __main__ N/A sqlalchemy Column Integer Unicode ForeignKey UnicodeText and_ or_ String Boolean cast null case create_engine sqlalchemy.orm relationship Session sqlalchemy.orm.collections attribute_mapped_collection sqlalchemy.ext.declarative declarative_base sqlalchemy.ext.associationproxy association_proxy N/A Base N/A declarative_base AnimalFact N/A PolymorphicVerticalProperty Base N/A N/A A fact about an animal. N/A __tablename__ animal_fact N/A animal_id N/A Column N/A ForeignKey animal.id primary_key True N/A key N/A Column N/A Unicode 64 primary_key True N/A type N/A Column N/A Unicode 16 N/A int_value N/A Column Integer info N/A type N/A int integer N/A char_value N/A Column UnicodeText info N/A type N/A str string N/A boolean_value N/A Column Boolean info N/A type N/A bool boolean N/A Animal N/A N/A N/A ProxiedDictMixin _base_class Base N/A N/A an Animal N/A __tablename__ animal N/A id N/A Column Integer primary_key True N/A name N/A Column N/A Unicode 100 N/A facts N/A relationship AnimalFact collection_class N/A attribute_mapped_collection key N/A _proxied N/A association_proxy facts value creator N/A N/A N/A key value N/A N/A AnimalFact key key value value __init__ N/A N/A self name N/A N/A N/A N/A self name name N/A __repr__ N/A N/A self N/A N/A N/A N/A Animal(%r) N/A self name N/A with_characteristic N/A N/A self key value N/A N/A N/A N/A N/A N/A self facts any key key value value N/A classmethod N/A N/A engine N/A create_engine sqlite:// echo True N/A N/A N/A N/A Base metadata create_all engine N/A session N/A Session engine N/A stoat N/A Animal stoat N/A N/A stoat N/A color red N/A N/A stoat N/A cuteness 7 N/A N/A stoat N/A weasel-like True N/A N/A N/A session add stoat N/A N/A N/A session commit N/A critter N/A N/A N/A N/A N/A N/A session query Animal filter N/A N/A Animal name stoat one N/A N/A critter N/A color N/A N/A critter N/A cuteness N/A changing cuteness value and type: N/A N/A critter N/A cuteness very cute N/A N/A N/A session commit N/A marten N/A Animal marten N/A N/A marten N/A cuteness 5 N/A N/A marten N/A weasel-like True N/A N/A marten N/A poisonous False N/A N/A N/A session add marten N/A shrew N/A Animal shrew N/A N/A shrew N/A cuteness 5 N/A N/A shrew N/A weasel-like False N/A N/A shrew N/A poisonous True N/A N/A N/A session add shrew N/A N/A N/A session commit N/A q N/A N/A N/A N/A session query Animal filter N/A N/A N/A Animal facts any N/A and_ N/A N/A AnimalFact key weasel-like N/A N/A AnimalFact value True N/A N/A weasel-like animals N/A N/A q all N/A q N/A N/A N/A N/A session query Animal filter N/A N/A Animal with_characteristic weasel-like True N/A N/A weasel-like animals again N/A N/A q all N/A q N/A N/A N/A N/A session query Animal filter N/A N/A Animal with_characteristic poisonous False N/A N/A animals with poisonous=False N/A N/A q all N/A q N/A N/A N/A N/A session query Animal filter N/A or_ N/A N/A Animal with_characteristic poisonous False N/A N/A N/A N/A Animal facts any N/A N/A AnimalFact key poisonous N/A N/A non-poisonous animals N/A N/A q all N/A q N/A N/A N/A N/A session query Animal filter N/A N/A N/A Animal facts any N/A N/A AnimalFact value 5 N/A N/A any animal with a .value of 5 N/A N/A q all