Given a list of FROM clauses and a selectable, return the first index and element from the list of clauses which can be joined against the selectable. returns None, None if no match is found. e.g.:: clause1 = table1.join(table2) clause2 = table4.join(table5)
(
clauses: List[FromClause], join_to: FromClause
)
| 129 | |
| 130 | |
| 131 | def find_join_source( |
| 132 | clauses: List[FromClause], join_to: FromClause |
| 133 | ) -> List[int]: |
| 134 | """Given a list of FROM clauses and a selectable, |
| 135 | return the first index and element from the list of |
| 136 | clauses which can be joined against the selectable. returns |
| 137 | None, None if no match is found. |
| 138 | |
| 139 | e.g.:: |
| 140 | |
| 141 | clause1 = table1.join(table2) |
| 142 | clause2 = table4.join(table5) |
| 143 | |
| 144 | join_to = table2.join(table3) |
| 145 | |
| 146 | find_join_source([clause1, clause2], join_to) == clause1 |
| 147 | |
| 148 | """ |
| 149 | |
| 150 | selectables = list(_from_objects(join_to)) |
| 151 | idx = [] |
| 152 | for i, f in enumerate(clauses): |
| 153 | for s in selectables: |
| 154 | if f.is_derived_from(s): |
| 155 | idx.append(i) |
| 156 | return idx |
| 157 | |
| 158 | |
| 159 | def find_left_clause_that_matches_given( |
nothing calls this directly
no test coverage detected