SQLAlchemy 0.6.1 Documentation

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

Utilities

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

Get an identity key.

Valid call signatures:

  • identity_key(class, ident)

    class

    mapped class (must be a positional argument)

    ident

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

  • identity_key(instance=instance)

    instance

    object instance (must be given as a keyword arg)

  • identity_key(class, row=row)

    class

    mapped class (must be a positional argument)

    row

    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.

instance
a parent instance, which should be persistent or detached.
property
a class-attached descriptor, MapperProperty or string property name attached to the parent instance.
**kwargs
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