class documentation

class Emulated(object):

Known subclasses: sqlalchemy.types.Boolean, sqlalchemy.types.Enum, sqlalchemy.types.Interval

View In Hierarchy

Mixin for base types that emulate the behavior of a DB-native type.

An .Emulated type will use an available database type in conjunction with Python-side routines and/or database constraints in order to approximate the behavior of a database type that is provided natively by some backends. When a native-providing backend is in use, the native version of the type is used. This native version should include the .NativeForEmulated mixin to allow it to be distinguished from .Emulated.

Current examples of .Emulated are: .Interval, .Enum, .Boolean.

New in version 1.2.0b3.
Method adapt Undocumented
Method adapt​_to​_emulated Given an impl class, adapt this type to the impl assuming "emulated".
def adapt(self, impltype, **kw):
overridden in sqlalchemy.types.Enum

Undocumented

def adapt_to_emulated(self, impltype, **kw):

Given an impl class, adapt this type to the impl assuming "emulated".

The impl should also be an "emulated" version of this type, most likely the same class as this type itself.

e.g.: sqltypes.Enum adapts to the Enum class.