Types related functions¶
-
metapensiero.sqlalchemy.proxy.types.get_adaptor_for_sa_type(satype)¶ Get an adaptor for the given type.
Parameters: satype – an SQLAlchemy TypeEngineReturn type: a function Return a function that adapts its unique argument to the given satype. In particular, an empty string value or
"NULL"are converted toNone.
-
metapensiero.sqlalchemy.proxy.types.get_metadata_for_sa_type(satype)¶ Get base metadata for the given type.
Parameters: satype – an SQLAlchemy TypeEngineor an instance of itReturn type: a dictionary Return a dictionary containing the base metadata information for the given satype.
-
metapensiero.sqlalchemy.proxy.types.register_sa_type_adaptor(cls, function)¶ Register an adaptor function for the given SQLAlchemy cls type.
Parameters: - cls – a class
- function – a callable, accepting one argument and returning a value compatible with cls
-
metapensiero.sqlalchemy.proxy.types.register_sa_type_metadata(cls, meta, merge=True)¶ Register/override metadata information for the given SQLAlchemy cls type.
Parameters: - cls – a class
- meta – a dictionary
- merge – a boolean
If cls is already registered and merge is
True(the default), then meta will overwrite existing information, basically doingexisting.update(meta).