gavo.votable.tablewriter module

Writing tabular data within VOTables.

gavo.votable.tablewriter.DelayedTable(tableDefinition, rowIterator, contentElement, overflowElement=None, **attrs)[source]

returns tableDefinition such that when serialized, it contains the data from rowIterator

rowIterator is an iterator yielding all rows from the table to be encoded, tableDefinition is the TABLE element, and ContentElement is one of the permitted DATA children from VOTable.

See the OverflowElement class for overflowElement.

attrs are optional attributes to the content element.

class gavo.votable.tablewriter.OverflowElement(rowLimit, overflowStan)[source]

Bases: gavo.utils.stanxml.Stub

A container for VOTable elements that are written when it is likely that a query has overflowed the limit.

This is for use with DelayedTable. Instances of this can be passed into overflowElement.

OverflowElements are constructed with the row limit and VOTable material to be inserted when exactly row limit (or more) rows have been written to the table.

All automatic namespace processing is turned off for the overflow element. This should not be a problem if you’re embedding VOTable elements into VOTables.

gavo.votable.tablewriter.asBytes(root, xmlDecl=False)[source]

returns the V.VOTABLE root as a string.

gavo.votable.tablewriter.write(root, outputFile, xmlDecl=True)[source]

writes a VOTable to outputFile.

This is a compatibility function that’s in this place mainly for historical reasons. It’s basically utils.xmlwrite, except that the prefix of the root element will be the empty prefix.