A representation of a JOIN clause. Ex: SELECT * FROM foo JOIN [ON ] The member variable boolean_expr will be an instance of a boolean func defined below.
| 565 | |
| 566 | |
| 567 | class JoinClause(object): |
| 568 | '''A representation of a JOIN clause. |
| 569 | |
| 570 | Ex: SELECT * FROM foo <join_type> JOIN <table_expr> [ON <boolean_expr>] |
| 571 | |
| 572 | The member variable boolean_expr will be an instance of a boolean func |
| 573 | defined below. |
| 574 | |
| 575 | ''' |
| 576 | |
| 577 | JOINS_TYPES = [ |
| 578 | 'INNER', |
| 579 | 'LEFT', |
| 580 | 'RIGHT', |
| 581 | 'LEFT SEMI', |
| 582 | 'LEFT ANTI', |
| 583 | 'RIGHT SEMI', |
| 584 | 'RIGHT ANTI', |
| 585 | 'FULL OUTER', |
| 586 | 'CROSS'] |
| 587 | |
| 588 | def __init__(self, join_type, table_expr, boolean_expr=None): |
| 589 | self.join_type = join_type |
| 590 | self.table_expr = table_expr |
| 591 | self.boolean_expr = boolean_expr |
| 592 | # This is used for nested types. It means that we are joining with an earlier aliased |
| 593 | # element in the from clause. For example, "From customer t1 INNER JOIN t1.orders t2" |
| 594 | # or "FROM customer t1 INNER JOIN t1.orders.lineitems t2 ON t1.comment = t2.comment" |
| 595 | # are both lateral joins. However, "FROM customer t1 INNER JOIN customer.orders t2 ON |
| 596 | # (t1.comment = t2.comment)" is not a lateral join. |
| 597 | # TODO: consider renaming to is_nested_join |
| 598 | self.is_lateral_join = False |
| 599 | |
| 600 | def __deepcopy__(self, memo): |
| 601 | other = JoinClause( |
| 602 | self.join_type, |
| 603 | deepcopy(self.table_expr, memo), |
| 604 | deepcopy(self.boolean_expr, memo)) |
| 605 | other.is_lateral_join = self.is_lateral_join |
| 606 | return other |
| 607 | |
| 608 | |
| 609 | class WhereClause(object): |
no outgoing calls
no test coverage detected