Join¶
- final class lsst.daf.relation.Join(predicate: ~lsst.daf.relation._columns._predicate.Predicate = <factory>, min_columns: frozenset[lsst.daf.relation._columns._tag.ColumnTag] = frozenset({}), max_columns: frozenset[lsst.daf.relation._columns._tag.ColumnTag] | None = None)¶
- Bases: - BinaryOperation- A natural join operation. - A natural join combines two relations by matching rows with the same values in their common columns (and satisfying an optional column expression, via a - Predicate), producing a new relation whose columns are the union of the columns of its operands. This is equivalent to [- INNER]- JOINin SQL.- Attributes Summary - The common columns between relations that will be used as an equality constraint ( - Set[- ColumnTag]).- The maximal set of columns that should be used in the equality constraint on - common_columns(- frozenset[- ColumnTag] or- None).- The minimal set of columns that should be used in the equality constraint on - common_columns(- frozenset[- ColumnTag]).- Methods Summary - applied_columns(lhs, rhs)- Return the columns of the relation that results from applying this operation to the given targets. - applied_common_columns(lhs, rhs)- Compute the actual common columns for a - Joingiven its targets.- applied_max_rows(lhs, rhs)- Return the maximum number of rows of the relation that results from applying this operation to the given target. - applied_min_rows(lhs, rhs)- Return the minimum number of rows of the relation that results from applying this operation to the given targets. - apply(lhs, rhs)- Create a new relation that represents the action of this operation on a pair of existing relations. - partial(fix[, is_lhs])- Return a - UnaryOperationthat represents this join with one operand already provided and held fixed.- Attributes Documentation - common_columns¶
- The common columns between relations that will be used as an equality constraint ( - Set[- ColumnTag]).- This attribute is not available on - Joininstances for which- min_columnsis not the same as- max_columns. It is always available on any- Joininstance attached to a- BinaryOperationRelationby- apply.
 - max_columns: frozenset[lsst.daf.relation._columns._tag.ColumnTag] | None = None¶
- The maximal set of columns that should be used in the equality constraint on - common_columns(- frozenset[- ColumnTag] or- None).- If the relations this operation is applied to have more columns in common than this set, they will not be included in the equality constraint. - This is guaranteed to be equal to - min_columnson any- Joininstance attached to a- BinaryOperationRelationby- apply.
 - min_columns: frozenset[lsst.daf.relation._columns._tag.ColumnTag] = frozenset({})¶
- The minimal set of columns that should be used in the equality constraint on - common_columns(- frozenset[- ColumnTag]).- If the relations this operation is applied to have common columsn that are not a superset of this set, - ColumnErrorwill be raised by- apply.- This is guaranteed to be equal to - max_columnson any- Joininstance attached to a- BinaryOperationRelationby- apply.
 - Methods Documentation - applied_columns(lhs: Relation, rhs: Relation) Set[ColumnTag]¶
- Return the columns of the relation that results from applying this operation to the given targets. 
 - applied_common_columns(lhs: Relation, rhs: Relation) frozenset[ColumnTag]¶
- Compute the actual common columns for a - Joingiven its targets.- Parameters:
- Returns:
- common_columnsSet[ColumnTag]
- Columns that are included in all of - lhs.columnsand- rhs.columnsand- max_columns, checked to be a superset of- min_columns.
 
- common_columns
- Raises:
- ColumnError
- Raised if the result would not be a superset of - min_columns.
 
 
 - applied_max_rows(lhs: Relation, rhs: Relation) int | None¶
- Return the maximum number of rows of the relation that results from applying this operation to the given target. 
 - applied_min_rows(lhs: Relation, rhs: Relation) int¶
- Return the minimum number of rows of the relation that results from applying this operation to the given targets. 
 - apply(lhs: Relation, rhs: Relation) Relation¶
- Create a new relation that represents the action of this operation on a pair of existing relations. - Parameters:
- Returns:
- new_relationRelation
- Relation that includes this operation. This may be - selfif the operation is a no-op, and it may not be a- BinaryOperationRelationholding this operation (or even a similar one) if the operation was inserted earlier in the tree via commutation relations.
 
- new_relation
- Raises:
- ColumnError
- Raised if the operation could not be applied due to problems with the target relations’ columns. 
- EngineError
- Raised if the operation could not be applied due to problems with the target relations’ engine(s). 
 
 
 - partial(fix: Relation, is_lhs: bool = False) PartialJoin¶
- Return a - UnaryOperationthat represents this join with one operand already provided and held fixed.- Parameters:
- Returns:
- partial_joinPartialJoin
- Unary operation representing a join to a fixed relation. 
 
- partial_join
- Raises:
- ColumnError
- Raised if the given predicate requires columns not present in - lhsor- rhs.
- RowOrderError
- Raised if - lhsor- rhsis unnecessarily ordered; see- Relation.expect_unordered.
 
 - Notes - This method and the class it returns are called “partial” in the spirit of - functools.partial: a callable formed by holding some arguments to another callable fixed.