Constraint

class pyvo.registry.rtcons.Constraint[source]

Bases: object

an abstract base class for data discovery contraints.

These, essentially, are configurable RegTAP query fragments, consisting of a where clause, parameters for filling that, and possibly additional tables.

Users construct concrete constraints with whatever they would like to constrain things with.

To implement a new constraint, in the constructor set _condition to a string with {}-type replacement fields (assume all parameters are strings), and define fillers to be a dictionary with values for the _condition template. Don’t worry about SQL-serialising the values, Constraint takes care of that. If you need your Constraint to be “lazy” (cf. Servicetype), it’s ok to overrride get_search_condition without an upcall to Constraint.

If your constraints need extra tables, give them in a list in _extra_tables.

For the legacy x_search with keywords, define a _keyword attribute containing the name of the parameter that should generate such a constraint. When pickung up such keywords, sequence values will in general be unpacked and turned into sequences of constraints. Constraints that want to the all arguments in the constructor can set takes_sequence to True.

Methods Summary

get_search_condition()

Formats this constraint to an ADQL fragment.

Methods Documentation

get_search_condition()[source]

Formats this constraint to an ADQL fragment.

Returns
str

A string ready for inclusion into a WHERE clause.