Module: elixir
Elixir package
A declarative layer on top of the SQLAlchemy library. It is a fairly thin wrapper, which provides the ability to create simple Python classes that map directly to relational database tables (this pattern is often referred to as the Active Record design pattern), providing many of the benefits of traditional databases without losing the convenience of Python objects.
Elixir is intended to replace the ActiveMapper SQLAlchemy extension, and the TurboEntity project but does not intend to replace SQLAlchemy's core features, and instead focuses on providing a simpler syntax for defining model objects when you do not need the full expressiveness of SQLAlchemy's manual mapper definitions.
Modules
collection
Default entity collection implementation
entity
This module provides the Entity base class, as well as its metaclass EntityMeta.
events
ext
Ext package
fields
This module provides support for defining the fields (columns) of your entities. Elixir currently supports two syntaxes to do so: the default Attribute-based syntax as well as the has_field DSL statement.
options
This module provides support for defining several options on your Elixir entities. There are three different kinds of options that can be set up, and for this there are three different statements: using_options, using_table_options and using_mapper_options.
properties
This module provides support for defining properties on your entities. It both provides, the Property class which acts as a building block for common properties such as fields and relationships (for those, please consult the corresponding modules), but also provides some more specialized properties, such as ColumnProperty and Synonym. It also provides the GenericProperty class which allows you to wrap any SQLAlchemy property, and its DSL-syntax equivalent: has_property.
py23compat
Some helper functions to get by without Python 2.4
relationships
This module provides support for defining relationships between your Elixir entities. Elixir currently supports two syntaxes to do so: the default Attribute-based syntax which supports the following types of relationships: ManyToOne, OneToMany, OneToOne and ManyToMany, as well as a DSL-based syntax which provides the following statements: belongs_to, has_many, has_one and has_and_belongs_to_many.
statements
Functions
cleanup_all (drop_tables=False, *args, **kwargs)
Clear all mappers, clear the session, and clear all metadatas. Optionally drops the tables.
create_all (*args, **kwargs)
Create the necessary tables for all declared entities
drop_all (*args, **kwargs)
Drop tables for all declared entities
setup_all (create_tables=False, *args, **kwargs)
Setup the table and mapper of all entities in the default entity collection.
This is called automatically if any entity of the collection is configured with the autosetup option and it is first accessed, instanciated (called) or the create_all method of a metadata containing tables from any of those entities is called.
Attributes
metadata
Value of metadata
MetaData(None)
session
Value of session
<sqlalchemy.orm.scoping.ScopedSession object at 0x1ddd950>
