gavo.base.valuemappers module¶
Serialising table rows.
The main class in this module is the SerManager, which knows about a target table and figures out how to turn the values in the table rows into strings.
This is used by formats.votablewrite and the HTML table serialisation.
utils.serializers has once been a part of this module. To save migration effort, for now it reproduces that module’s interface.
- class gavo.base.valuemappers.SerManager(table, withRanges=True, acquireSamples=True, idManager=None, mfRegistry=<gavo.utils.serializers.ValueMapperFactoryRegistry object>)[source]¶
Bases:
IdManagerMixin
A wrapper for the serialisation of table data.
SerManager instances keep information on what values certain columns can assume and how to map them to concrete values in VOTables, HTML or ASCII.
They are constructed with a BaseTable instance.
You can additionally give:
withRanges – ignored, going away
acquireSamples – ignored, going away
- idManager – an object mixing in utils.IdManagerMixin. This is important
if the ids we are assigning here end up in a larger document. In that case, pass in the id manager of that larger document. Default is the SerManager itself
mfRegistry – a map factory registry. Default is the defaltMFRegistry, which is suitable for VOTables.
Iterate over a SerManager to retrieve the annotated columns.
- class gavo.base.valuemappers.VOTNameMaker[source]¶
Bases:
object
A class for generating db-unique names from VOTable fields.
This is important to avoid all kinds of weird names the remaining infrastructure will not handle. “Normal” TableDefs assume unquoted SQL identifiers as names, and want all names unique.
Using this class ensures these expectations are met in a reproducible way (i.e., given the same table, the same names will be assigned).