fictive.transform.ext.sqlalchemy package¶
Module contents¶
Integrating Transform with SQLAlchemy
-
class
fictive.transform.ext.sqlalchemy.TransformColumnType(base_type, transform, *args, pass_null=True, **kwargs)[source]¶ Bases:
sqlalchemy.sql.type_api.TypeDecoratorA TypeDecorator (i.e., SQLAlchemy column type) that automatically applies a transform
-
__init__(base_type, transform, *args, pass_null=True, **kwargs)[source]¶ Construct a
TypeDecorator.Arguments sent here are passed to the constructor of the class assigned to the
implclass level attribute, assuming theimplis a callable, and the resulting object is assigned to theself.implinstance attribute (thus overriding the class attribute of the same name).If the class level
implis not a callable (the unusual case), it will be assigned to the same instance attribute ‘as-is’, ignoring those arguments passed to the constructor.Subclasses can override this to customize the generation of
self.implentirely.
-
impl¶ alias of
sqlalchemy.sql.type_api.TypeEngine
-
load_dialect_impl(dialect)[source]¶ Return a
TypeEngineobject corresponding to a dialect.This is an end-user override hook that can be used to provide differing types depending on the given dialect. It is used by the
TypeDecoratorimplementation oftype_engine()to help determine what type should ultimately be returned for a givenTypeDecorator.By default returns
self.impl.
-
process_literal_param(value, dialect)[source]¶ Receive a literal parameter value to be rendered inline within a statement.
This method is used when the compiler renders a literal value without using binds, typically within DDL such as in the “server default” of a column or an expression within a CHECK constraint.
The returned string will be rendered into the output string.
New in version 0.9.0.
-
property
python_type¶ Return the Python type object expected to be returned by instances of this type, if known.
Basically, for those types which enforce a return type, or are known across the board to do such for all common DBAPIs (like
intfor example), will return that type.If a return type is not defined, raises
NotImplementedError.Note that any type also accommodates NULL in SQL which means you can also get back
Nonefrom any type in practice.
-