Package gavo :: Package registry :: Module tableset
[frames] | no frames]

Module tableset

source code

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).

Functions
 
simpleDataTypeFactory(dbType, declaredXtype=None) source code
 
voTableDataTypeFactory(dbType, declaredXtype=None) source code
 
getSchemaForRD(rd)
returns a VS.schema instance for an rd.
source code
 
getForeignKeyForForeignKey(fk, namesInSet)
returns a VS.foreignKey for a rscdef.ForeignKey.
source code
 
getTableColumnFromColumn(column, typeFactory)
returns a VS.column instance for an rscdef.Column instance.
source code
 
getEffectiveTableName(tableDef)
returns the "effective name" of tableDef.
source code
 
getTableForTableDef(tableDef, namesInSet, rootElement=<class 'gavo.registry.model.table'>, suppressBodies=False)
returns a VS.table instance for a rscdef.TableDef.
source code
 
getTablesetForSchemaCollection(schemas, rootElement=<class 'gavo.registry.model.tableset'>, suppressBodies=False)
returns a vs:tableset element from a sequence of (rd, tables) pairs.
source code
 
getTablesetForService(resource, rootElement=<class 'gavo.registry.model.tableset'>, suppressBodies=False)
returns a VS.tableset for a service or a published data resource.
source code
Variables
  __package__ = 'gavo.registry'
Function Details

getSchemaForRD(rd)

source code 

returns a VS.schema instance for an rd.

No tables are added. You need to pick and choose them yourself.

getForeignKeyForForeignKey(fk, namesInSet)

source code 

returns a VS.foreignKey for a rscdef.ForeignKey.

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

getTableColumnFromColumn(column, typeFactory)

source code 

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.

getEffectiveTableName(tableDef)

source code 

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).

getTableForTableDef(tableDef, namesInSet, rootElement=<class 'gavo.registry.model.table'>, suppressBodies=False)

source code 

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.

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

source code 

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.

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

source code 

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.