gavo.registry.tableset module

Generation of VODataService 1.1 tablesets from resources.

Fudge note: sprinkled in below are lots of lower()s for column names and the like. These were added for the convenience of TAP clients that may want to use these names quoted. Quoted identifiers match regular identifiers only if case-normalized (i.e., all-lower in DaCHS).


returns the “effective name” of tableDef.

This is mainly for fudging the names of output tables since, by default, they’re ugly (and meaningless on top of that).

gavo.registry.tableset.getForeignKeyForForeignKey(fk, namesInSet)[source]

returns a VS.foreignKey for a rscdef.ForeignKey.

If the target table’s name is not in nameInSet, the foreign key is not created.

gavo.registry.tableset.getTableColumnFromColumn(column, typeFactory)[source]

returns a VS.column instance for an rscdef.Column instance.

typeElement is a factory for types that has to accept an internal (SQL) type as child and generate whatever is necessary from that.

This module contains simpleDataTypeFactory, voTableDataTypeFactory, and should soon contain tapTypeFactory.

gavo.registry.tableset.getTableForTableDef(tableDef, namesInSet, rootElement=<class 'gavo.registry.model.VS.table'>, suppressBodies=False)[source]

returns a VS.table instance for a rscdef.TableDef.

namesInSet is a set of lowercased qualified table names; we need this to figure out which foreign keys to create.

gavo.registry.tableset.getTablesetForSchemaCollection(schemas, rootElement=<class 'gavo.registry.model.VS.tableset'>, suppressBodies=False)[source]

returns a vs:tableset element from a sequence of (rd, tables) pairs.

In each pair, rd is used to define a VODataService schema, and tables is a sequence of TableDefs that define the tables within that schema.

gavo.registry.tableset.getTablesetForService(resource, rootElement=<class 'gavo.registry.model.VS.tableset'>, suppressBodies=False)[source]

returns a VS.tableset for a service or a published data resource.

This is for VOSI queries and the generation of registry records. Where it actually works on services, it uses the service’s getTableset method to find out the service’s table set; if it’s passed a TableDef of a DataDescriptor, it will turn these into tablesets.

Sorry about the name.

gavo.registry.tableset.simpleDataTypeFactory(dbType, declaredXtype=None)[source]
gavo.registry.tableset.voTableDataTypeFactory(dbType, declaredXtype=None)[source]