gavo.adql.common module

Exceptions and helper functions for ADQL processing.

class gavo.adql.common.Absent[source]

Bases: object

is a sentinel to pass as default to nodes.getChildOfType.

exception gavo.adql.common.AmbiguousColumn(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

is raised if a column name matches more than one column in a compound query.

exception gavo.adql.common.BadKeywords(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

is raised when an ADQL node is constructed with bad keywords.

This is a development help and should not occur in production code.

exception gavo.adql.common.ColumnNotFound(colName, hint=None)[source]

Bases: Error, NotFoundError

is raised if a column name cannot be resolved.

exception gavo.adql.common.Error(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

A base class for the exceptions from this module.

class gavo.adql.common.FieldInfoGetter[source]

Bases: object

An abstract class to retrieve table metadata.

A subclass of this must be passed into adql.parseAnnotating. Implementations must fill out the getInfosFor(tableName) method, which must return a sequence of (column name, adql.FieldInfo) pairs for the named table.

plain strings for table names will be normalised (lowercased).

addExtraFieldInfos(tableName, fieldInfos)[source]

adds field infos for tableName.

fieldInfos must be a sequence of (columnName, adql.FieldInfo) pairs.

Note that tableName is normalised to lowercase here.

getInfosFor(tableName)[source]
normalizeName(tableName)[source]
exception gavo.adql.common.FlattenError(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

is raised when something cannot be flattened.

exception gavo.adql.common.GeometryError(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

is raised if something is wrong with a geometry.

exception gavo.adql.common.IncompatibleTables(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

is raised when the operands of a set operation are not deemed compatible.

exception gavo.adql.common.MoreThanOneChild(searchedType, toks)[source]

Bases: NoChild

is raised if a node is asked for a unique child but has more than one.

exception gavo.adql.common.MorphError(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

is raised when the expectations of the to-ADQL morphers are violated.

exception gavo.adql.common.NoChild(searchedType, toks)[source]

Bases: Error

is raised if a node is asked for a non-existing child.

exception gavo.adql.common.NotImplementedError(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

is raised for features we don’t (yet) support.

exception gavo.adql.common.RegionError(msg: str = '', hint: Optional[str] = None)[source]

Bases: GeometryError

is raised if a region specification is in some way bad.

exception gavo.adql.common.TableNotFound(tableName, hint=None)[source]

Bases: Error, NotFoundError

is raised when a table name cannot be resolved.

exception gavo.adql.common.UfuncError(msg: str = '', hint: Optional[str] = None)[source]

Bases: Error

is raised if something is wrong with a call to a user defined function.

gavo.adql.common.computeCommonColumns(tableNode)[source]

returns a set of column names that only occur once in the result table.

For a natural join, that’s all column names occurring in all tables, for a USING join, that’s all names occurring in USING, else it’s an empty set.

gavo.adql.common.getUniqueMatch(matches, colName)[source]

returns the only item of matches if there is exactly one, raises an appropriate exception if not.