gavo.adql.fieldinfos module¶
FieldInfos are collections of inferred metadata on the columns present within ADQL relations.
In generation, this module distinguishes between query-like (select…) and table-like (from table references) field infos. The functions here are called from the addFieldInfo methods of the respective nodes classes.
- class gavo.adql.fieldinfos.FieldInfos(parent, context)[source]¶
Bases:
object
A base class for field annotations.
Subclasses of those are attached to physical tables, joins, and subqueries.
The information on columns is kept in two places:
- seq – a sequence of attributes of the columns in the
order in which they are selected
- columns – maps column names to attributes or None if a column
name is not unique. Column names are normalized by lowercasing here (which, however, does not affect L{utils.QuotedName}s).
A FieldInfos object is instantiated with the object it will annotate, and the annotation (i.e., setting of the fieldInfos attribute on the parent) will happen during instantiation.
- addColumn(label, info)[source]¶
adds a new visible column to this info.
This entails both entering it in self.columns and in self.seq.
- assertIsCompatible(other)[source]¶
raises an IncompatibleTables if the FieldInfos other have different length or names from self.
- class gavo.adql.fieldinfos.QueryFieldInfos(parent, context)[source]¶
Bases:
FieldInfos
FieldInfos inferred from a FROM clause.
To instantiate those, use the makeForNode class method below.
- enclosingQuery = None¶
- getFieldInfo(colName, refName=None)[source]¶
returns a field info for colName in self or any tables this query takes columns from.
To do that, it collects all fields of colName in self and subTables and returns the matching field if there’s exactly one. Otherwise, it will raise ColumnNotFound or AmbiguousColumn.
If the node.TableName instance refName is given, the search will be restricted to the matching tables.
- class gavo.adql.fieldinfos.TableFieldInfos(parent, context)[source]¶
Bases:
FieldInfos
FieldInfos coming from something that’s basically a table in the DB.
This includes joins.
To instantiate those, use the makeForNode class method below.