Given the columns clause and ORDER BY of a selectable, return a list of column expressions that can be added to the collist corresponding to the ORDER BY, without repeating those already in the collist.
(collist, order_by)
| 427 | |
| 428 | |
| 429 | def expand_column_list_from_order_by(collist, order_by): |
| 430 | """Given the columns clause and ORDER BY of a selectable, |
| 431 | return a list of column expressions that can be added to the collist |
| 432 | corresponding to the ORDER BY, without repeating those already |
| 433 | in the collist. |
| 434 | |
| 435 | """ |
| 436 | cols_already_present = { |
| 437 | col.element if col._order_by_label_element is not None else col |
| 438 | for col in collist |
| 439 | } |
| 440 | |
| 441 | to_look_for = list(chain(*[unwrap_order_by(o) for o in order_by])) |
| 442 | |
| 443 | return [col for col in to_look_for if col not in cols_already_present] |
| 444 | |
| 445 | |
| 446 | def clause_is_present(clause, search): |
nothing calls this directly
no test coverage detected