defernia.orm — Object-relational mapping powered by SQLAlchemy

This module provides object-relational mapping facilities powered by SQLAlchemy.

In order to define persist model class, just subclass Base:

from sqlalchemy import *
import defernia.orm


class Thing(defernia.orm.Base):
    '''A something object-relationally mapped.'''

    id = Column(Integer, primary_key=True)
    value = Column(UnicodeText, nullable=False)
    __tablename__ = 'things'
defernia.orm.Session = sessionmaker(class_='Session'autoflush=True, bind=None, autocommit=True, expire_on_commit=True)

SQLAlchemy session class.

See also

SQLAlchemy — Using the Session
Session is the primary usage interface for persistence operations.
class defernia.orm.Base(**kwargs)

SQLAlchemy declarative base class.

See also

SQLAlchemy — Declarative
Declarative allows all three to be expressed at once within the class declaration.
defernia.orm.make_repr(self)

Make a repr() string for the given self object.

Parameters:self – an object to make a repr() string
Returns:a repr() string
Return type:str

Project Versions

Previous topic

defernia — The system for conworld

Next topic

defernia.user — Defernia users

This Page