Files
sqlalchemy/doc/build/reference/orm/mapping.rst
T
Mike Bayer 55ae7d7842 - Added support for @classproperty to provide
any kind of schema/mapping construct from a
declarative mixin, including columns with foreign
keys, relationships, column_property, deferred.
This solves all such issues on declarative mixins.
An error is raised if any MapperProperty subclass
is specified on a mixin without using @classproperty.
[ticket:1751] [ticket:1796] [ticket:1805]

- un-anglicized the declarative docs
2010-07-03 14:53:37 -04:00

97 lines
2.0 KiB
ReStructuredText

Class Mapping
=============
.. module:: sqlalchemy.orm
Defining Mappings
-----------------
Python classes are mapped to the database using the :func:`mapper` function.
.. autofunction:: mapper
Mapper Properties
-----------------
A basic mapping of a class will simply make the columns of the
database table or selectable available as attributes on the class.
**Mapper properties** allow you to customize and add additional
properties to your classes, for example making the results one-to-many
join available as a Python list of :func:`related <relationship>` objects.
Mapper properties are most commonly included in the :func:`mapper`
call::
mapper(Parent, properties={
'children': relationship(Children)
}
.. autofunction:: backref
.. autofunction:: column_property
.. autofunction:: comparable_property
.. autofunction:: composite
.. autofunction:: deferred
.. autofunction:: dynamic_loader
.. autofunction:: relation
.. autofunction:: relationship
.. autofunction:: synonym
Decorators
----------
.. autofunction:: reconstructor
.. autofunction:: validates
Utilities
---------
.. autofunction:: object_mapper
.. autofunction:: class_mapper
.. autofunction:: compile_mappers
.. autofunction:: clear_mappers
Attribute Utilities
-------------------
.. autofunction:: sqlalchemy.orm.attributes.del_attribute
.. autofunction:: sqlalchemy.orm.attributes.get_attribute
.. autofunction:: sqlalchemy.orm.attributes.get_history
.. autofunction:: sqlalchemy.orm.attributes.init_collection
.. function:: sqlalchemy.orm.attributes.instance_state
Return the :class:`InstanceState` for a given object.
.. autofunction:: sqlalchemy.orm.attributes.is_instrumented
.. function:: sqlalchemy.orm.attributes.manager_of_class
Return the :class:`ClassManager` for a given class.
.. autofunction:: sqlalchemy.orm.attributes.set_attribute
.. autofunction:: sqlalchemy.orm.attributes.set_committed_value
Internals
---------
.. autoclass:: sqlalchemy.orm.mapper.Mapper
:members:
.. autoclass:: sqlalchemy.orm.interfaces.MapperProperty
:members: