SQLAlchemy 0.6.1 Documentation

Version: 0.6.1 Last Updated: 07/25/2016 21:14:41
API Reference | Index


sqlalchemy.orm.util.identity_key(*args, **kwargs)

Get an identity key.

Valid call signatures:

  • identity_key(class, ident)


    mapped class (must be a positional argument)


    primary key, if the key is composite this is a tuple

  • identity_key(instance=instance)


    object instance (must be given as a keyword arg)

  • identity_key(class, row=row)


    mapped class (must be a positional argument)


    result proxy row (must be given as a keyword arg)

class sqlalchemy.orm.util.Validator(key, validator)

Runs a validation method on an attribute value to be set or appended.

The Validator class is used by the validates() decorator, and direct access is usually not needed.

__init__(key, validator)

Construct a new Validator.

key - name of the attribute to be validated; will be passed as the second argument to the validation method (the first is the object instance itself).

validator - an function or instance method which accepts three arguments; an instance (usually just ‘self’ for a method), the key name of the attribute, and the value. The function should return the same value given, unless it wishes to modify it.

append(state, value, initiator)
set(state, value, oldvalue, initiator)
sqlalchemy.orm.util.with_parent(instance, prop)

Return criterion which selects instances with a given parent.

a parent instance, which should be persistent or detached.
a class-attached descriptor, MapperProperty or string property name attached to the parent instance.
all extra keyword arguments are propagated to the constructor of Query.
sqlalchemy.orm.util.polymorphic_union(table_map, typecolname, aliasname='p_union')

Create a UNION statement used by a polymorphic mapper.

See Concrete Table Inheritance for an example of how this is used.

Previous: Interfaces Next: sqlalchemy.dialects