Predicate¶
- final class lsst.daf.butler.queries.tree.Predicate(*, operands: tuple[tuple[typing.Annotated[lsst.daf.butler.queries.tree._predicate.IsNull | lsst.daf.butler.queries.tree._predicate.Comparison | lsst.daf.butler.queries.tree._predicate.InContainer | lsst.daf.butler.queries.tree._predicate.InRange | lsst.daf.butler.queries.tree._predicate.InQuery | lsst.daf.butler.queries.tree._predicate.BooleanWrapper | lsst.daf.butler.queries.tree._predicate.LogicalNot, FieldInfo(annotation=NoneType, required=True, discriminator='predicate_type')], ...], ...])¶
- Bases: - QueryTreeBase- A boolean column expression. - Notes - Predicate is the only class representing a boolean column expression that should be used outside of this module (though the objects it nests appear in its serialized form and hence are not fully private). It provides several - classmethodfactories for constructing those nested types inside a- Predicateinstance, and- PredicateVisitorsubclasses should be used to process them.- Attributes Summary - A string enumeration value representing the type of the column expression. - Configuration for the model, should be a dictionary conforming to [ - ConfigDict][pydantic.config.ConfigDict].- Methods Summary - compare(a, operator, b)- Construct a predicate representing a binary comparison between two non-boolean column expressions. - from_bool(value)- Construct a predicate that always evaluates to - Trueor- False.- from_bool_expression(value)- Construct a predicate that wraps a boolean ColumnReference, taking on the value of the underlying ColumnReference. - gather_governors(governors)- Add any governor dimensions that need to be fully identified for this column expression to be sound. - gather_required_columns(columns)- Add any columns required to evaluate this predicate to the given column set. - in_container(member, container)- Construct a predicate that tests whether one column expression is a member of a container of other column expressions. - in_query(member, column, query_tree)- Construct a predicate that tests whether a column expression is present in a single-column projection of a query tree. - in_range(member[, start, stop, step])- Construct a predicate that tests whether an integer column expression is part of a strided range. - is_null(operand)- Construct a predicate that tests whether a column expression is NULL. - logical_and(*args)- Construct a predicate representing the logical AND of this predicate and one or more others. - Construct a predicate representing the logical NOT of this predicate. - logical_or(*args)- Construct a predicate representing the logical OR of this predicate and one or more others. - visit(visitor)- Invoke the visitor interface. - Attributes Documentation - column_type¶
- A string enumeration value representing the type of the column expression. 
 - model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True, 'strict': True}¶
- Configuration for the model, should be a dictionary conforming to [ - ConfigDict][pydantic.config.ConfigDict].
 - Methods Documentation - classmethod compare(a: IntColumnLiteral | StringColumnLiteral | FloatColumnLiteral | HashColumnLiteral | UUIDColumnLiteral | DateTimeColumnLiteral | TimespanColumnLiteral | RegionColumnLiteral | DimensionKeyReference | DimensionFieldReference | DatasetFieldReference | UnaryExpression | BinaryExpression, operator: Literal['==', '!=', '<', '>', '>=', '<=', 'overlaps', 'glob'], b: IntColumnLiteral | StringColumnLiteral | FloatColumnLiteral | HashColumnLiteral | UUIDColumnLiteral | DateTimeColumnLiteral | TimespanColumnLiteral | RegionColumnLiteral | DimensionKeyReference | DimensionFieldReference | DatasetFieldReference | UnaryExpression | BinaryExpression) Predicate¶
- Construct a predicate representing a binary comparison between two non-boolean column expressions. - Parameters:
- aColumnExpression
- First column expression in the comparison. 
- operatorstr
- Enumerated string representing the comparison operator to apply. May be and of “==”, “!=”, “<”, “>”, “<=”, “>=”, or “overlaps”. 
- bColumnExpression
- Second column expression in the comparison. 
 
- a
- Returns:
- predicatePredicate
- Predicate representing the comparison. 
 
- predicate
 
 - classmethod from_bool(value: bool) Predicate¶
- Construct a predicate that always evaluates to - Trueor- False.
 - classmethod from_bool_expression(value: DimensionKeyReference | DimensionFieldReference | DatasetFieldReference) Predicate¶
- Construct a predicate that wraps a boolean ColumnReference, taking on the value of the underlying ColumnReference. - Parameters:
- valueColumnExpression
- Boolean-valued expression to convert to Predicate. 
 
- value
- Returns:
- predicatePredicate
- Predicate representing the expression. 
 
- predicate
 
 - gather_governors(governors: set[str]) None¶
- Add any governor dimensions that need to be fully identified for this column expression to be sound. 
 - gather_required_columns(columns: ColumnSet) None¶
- Add any columns required to evaluate this predicate to the given column set. - Parameters:
- columnsColumnSet
- Set of columns to modify in place. 
 
- columns
 
 - classmethod in_container(member: IntColumnLiteral | StringColumnLiteral | FloatColumnLiteral | HashColumnLiteral | UUIDColumnLiteral | DateTimeColumnLiteral | TimespanColumnLiteral | RegionColumnLiteral | DimensionKeyReference | DimensionFieldReference | DatasetFieldReference | UnaryExpression | BinaryExpression, container: Iterable[IntColumnLiteral | StringColumnLiteral | FloatColumnLiteral | HashColumnLiteral | UUIDColumnLiteral | DateTimeColumnLiteral | TimespanColumnLiteral | RegionColumnLiteral | DimensionKeyReference | DimensionFieldReference | DatasetFieldReference | UnaryExpression | BinaryExpression]) Predicate¶
- Construct a predicate that tests whether one column expression is a member of a container of other column expressions. 
 - classmethod in_query(member: ColumnExpression, column: ColumnExpression, query_tree: QueryTree) Predicate¶
- Construct a predicate that tests whether a column expression is present in a single-column projection of a query tree. - Parameters:
- memberColumnExpression
- Column expression that may be present in the query. 
- columnColumnExpression
- Column to project from the query. 
- query_treeQueryTree
- Query tree to select from. 
 
- member
- Returns:
- predicatePredicate
- Predicate representing the membership test. 
 
- predicate
 
 - classmethod in_range(member: IntColumnLiteral | StringColumnLiteral | FloatColumnLiteral | HashColumnLiteral | UUIDColumnLiteral | DateTimeColumnLiteral | TimespanColumnLiteral | RegionColumnLiteral | DimensionKeyReference | DimensionFieldReference | DatasetFieldReference | UnaryExpression | BinaryExpression, start: int = 0, stop: int | None = None, step: int = 1) Predicate¶
- Construct a predicate that tests whether an integer column expression is part of a strided range. - Parameters:
- Returns:
- predicatePredicate
- Predicate representing the membership test. 
 
- predicate
 
 - classmethod is_null(operand: IntColumnLiteral | StringColumnLiteral | FloatColumnLiteral | HashColumnLiteral | UUIDColumnLiteral | DateTimeColumnLiteral | TimespanColumnLiteral | RegionColumnLiteral | DimensionKeyReference | DimensionFieldReference | DatasetFieldReference | UnaryExpression | BinaryExpression) Predicate¶
- Construct a predicate that tests whether a column expression is NULL. - Parameters:
- operandColumnExpression
- Column expression to test. 
 
- operand
- Returns:
- predicatePredicate
- Predicate representing the NULL check. 
 
- predicate
 
 - logical_and(*args: Predicate) Predicate¶
- Construct a predicate representing the logical AND of this predicate and one or more others. 
 - logical_not() Predicate¶
- Construct a predicate representing the logical NOT of this predicate. - Returns:
- predicatePredicate
- Predicate representing the logical NOT. 
 
- predicate