# SQLAlchemy 0.4 Documentation

Multiple Pages | One Page
Version: 0.4.1 Last Updated: 11/18/07 17:50:18

### module sqlalchemy.orm.properties

Defines a set of mapper.MapperProperty objects, including basic column properties as well as relationships. The objects rely upon the LoaderStrategy objects in the strategies.py module to handle load operations. PropertyLoader also relies upon the dependency.py module to handle flush-time dependency sorting and processing.

### class BackRef(object)

Attached to a PropertyLoader to indicate a complementary reverse relationship.

Can optionally create the complementing PropertyLoader if one does not exist already.

def __init__(self, key, _prop=None, **kwargs)

Construct a new `BackRef`.

def compile(self, prop)
def get_extension(self)

Return an attribute extension to use with this backreference.

back to section top

### class ColumnProperty(StrategizedProperty)

Describes an object attribute that corresponds to a table column.

def __init__(self, *columns, **kwargs)

The list of columns describes a single object property. If there are multiple tables joined together for the mapper, this list represents the equivalent column as it appears across each table.

def copy(self)
def create_strategy(self)
def get_col_value(self, column, value)
def get_history(self, obj, passive=False)
def getattr(self, object, column)
def merge(self, session, source, dest, dont_load, _recursive)
def setattr(self, object, value, column)
back to section top

### class CompositeProperty(ColumnProperty)

subclasses ColumnProperty to provide composite type support.

def __init__(self, class_, *columns, **kwargs)

Construct a new `CompositeProperty`.

def copy(self)
def get_col_value(self, column, value)
def getattr(self, object, column)
def setattr(self, object, value, column)
back to section top

### class PropertyLoader(StrategizedProperty)

Describes an object property that holds a single item or list of items that correspond to a related database table.

def __init__(self, argument, secondary=None, primaryjoin=None, secondaryjoin=None, entity_name=None, foreign_keys=None, foreignkey=None, uselist=None, private=False, association=None, order_by=False, attributeext=None, backref=None, is_backref=False, post_update=False, cascade=None, viewonly=False, lazy=True, collection_class=None, passive_deletes=False, remote_side=None, enable_typechecks=True, join_depth=None, strategy_class=None)

Construct a new `PropertyLoader`.

def cascade_callable(self, type, object, callable_, recursive, halt_on=None)
def cascade_iterator(self, type, object, recursive, halt_on=None)
def compare(self, op, value, value_is_parent=False)
def create_strategy(self)
def do_init(self)
def get_join(self, parent, primary=True, secondary=True, polymorphic_parent=True)

return a join condition from the given parent mapper to this PropertyLoader's mapper.

The resulting ClauseElement object is cached and should not be modified directly.

> parent
>   a mapper which has a relation() to this PropertyLoader. A PropertyLoader can have multiple "parents" when its actual parent mapper has inheriting mappers.
> primary
>   include the primary join condition in the resulting join.
> secondary
>   include the secondary join condition in the resulting join. If both primary and secondary are returned, they are joined via AND.
> polymorphic_parent
>   if True, use the parent's 'select_table' instead of its 'mapped_table' to produce the join.

def merge(self, session, source, dest, dont_load, _recursive)
private = property()
def register_dependencies(self, uowcommit)
back to section top