Package coprs :: Module helpers :: Class JSONEncodedDict
[hide private]
[frames] | no frames]

Class JSONEncodedDict

source code


Represents an immutable structure as a json-encoded string.

Usage:

   JSONEncodedDict(255)
Nested Classes [hide private]
  impl
The SQL VARCHAR type.

Inherited from sqlalchemy.sql.type_api.TypeDecorator: Comparator

Instance Methods [hide private]
 
process_bind_param(self, value, dialect)
Receive a bound parameter value to be converted.
source code
 
process_result_value(self, value, dialect)
Receive a result-row column value to be converted.
source code

Inherited from sqlalchemy.sql.type_api.TypeDecorator: __getattr__, __init__, __repr__, bind_processor, coerce_compared_value, compare_values, copy, get_dbapi_type, literal_processor, load_dialect_impl, process_literal_param, result_processor, type_engine

Inherited from sqlalchemy.sql.type_api.TypeDecorator (private): _compiler_dispatch, _gen_dialect_impl, _has_bind_processor, _has_literal_processor, _has_result_processor

Inherited from sqlalchemy.sql.type_api.TypeEngine: __str__, adapt, bind_expression, column_expression, compare_against_backend, compile, copy_value, dialect_impl, with_variant

Inherited from sqlalchemy.sql.type_api.TypeEngine (private): _cached_bind_processor, _cached_literal_processor, _cached_result_processor, _compare_type_affinity, _default_dialect, _dialect_info, _has_bind_expression, _has_column_expression

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]

Inherited from sqlalchemy.sql.type_api.TypeDecorator: __visit_name__, coerce_to_is_types

Inherited from sqlalchemy.sql.type_api.TypeEngine: hashable

Inherited from sqlalchemy.sql.type_api.TypeEngine (private): _isnull, _sqla_type

Properties [hide private]

Inherited from sqlalchemy.sql.type_api.TypeDecorator: comparator_factory

Inherited from sqlalchemy.sql.type_api.TypeDecorator (private): _type_affinity

Inherited from sqlalchemy.sql.type_api.TypeEngine: python_type

Inherited from object: __class__

Method Details [hide private]

process_bind_param(self, value, dialect)

source code 
Receive a bound parameter value to be converted.

Subclasses override this method to return the
value that should be passed along to the underlying
:class:`.TypeEngine` object, and from there to the
DBAPI ``execute()`` method.

The operation could be anything desired to perform custom
behavior, such as transforming or serializing data.
This could also be used as a hook for validating logic.

This operation should be designed with the reverse operation
in mind, which would be the process_result_value method of
this class.

:param value: Data to operate upon, of any type expected by
 this method in the subclass.  Can be ``None``.
:param dialect: the :class:`.Dialect` in use.

Overrides: sqlalchemy.sql.type_api.TypeDecorator.process_bind_param
(inherited documentation)

process_result_value(self, value, dialect)

source code 
Receive a result-row column value to be converted.

Subclasses should implement this method to operate on data
fetched from the database.

Subclasses override this method to return the
value that should be passed back to the application,
given a value that is already processed by
the underlying :class:`.TypeEngine` object, originally
from the DBAPI cursor method ``fetchone()`` or similar.

The operation could be anything desired to perform custom
behavior, such as transforming or serializing data.
This could also be used as a hook for validating logic.

:param value: Data to operate upon, of any type expected by
 this method in the subclass.  Can be ``None``.
:param dialect: the :class:`.Dialect` in use.

This operation should be designed to be reversible by
the "process_bind_param" method of this class.

Overrides: sqlalchemy.sql.type_api.TypeDecorator.process_result_value
(inherited documentation)