(self)
| 7792 | ) |
| 7793 | |
| 7794 | def test_nested_api(self): |
| 7795 | from sqlalchemy.engine.cursor import CursorResultMetaData |
| 7796 | |
| 7797 | stmt2 = select(table2).subquery() |
| 7798 | |
| 7799 | stmt1 = select(table1).select_from(stmt2) |
| 7800 | |
| 7801 | contexts = {} |
| 7802 | |
| 7803 | int_ = Integer() |
| 7804 | |
| 7805 | class MyCompiler(compiler.SQLCompiler): |
| 7806 | def visit_select(self, stmt, *arg, **kw): |
| 7807 | if stmt is stmt2.element: |
| 7808 | with self._nested_result() as nested: |
| 7809 | contexts[stmt2.element] = nested |
| 7810 | text = super().visit_select( |
| 7811 | stmt2.element, |
| 7812 | ) |
| 7813 | self._add_to_result_map("k1", "k1", (1, 2, 3), int_) |
| 7814 | else: |
| 7815 | text = super().visit_select(stmt, *arg, **kw) |
| 7816 | self._add_to_result_map("k2", "k2", (3, 4, 5), int_) |
| 7817 | return text |
| 7818 | |
| 7819 | comp = MyCompiler(default.DefaultDialect(), stmt1) |
| 7820 | eq_( |
| 7821 | CursorResultMetaData._create_description_match_map( |
| 7822 | contexts[stmt2.element][0] |
| 7823 | ), |
| 7824 | { |
| 7825 | "otherid": ( |
| 7826 | "otherid", |
| 7827 | ( |
| 7828 | table2.c.otherid, |
| 7829 | "otherid", |
| 7830 | "otherid", |
| 7831 | "myothertable_otherid", |
| 7832 | ), |
| 7833 | table2.c.otherid.type, |
| 7834 | 0, |
| 7835 | ), |
| 7836 | "othername": ( |
| 7837 | "othername", |
| 7838 | ( |
| 7839 | table2.c.othername, |
| 7840 | "othername", |
| 7841 | "othername", |
| 7842 | "myothertable_othername", |
| 7843 | ), |
| 7844 | table2.c.othername.type, |
| 7845 | 1, |
| 7846 | ), |
| 7847 | "k1": ("k1", (1, 2, 3), int_, 2), |
| 7848 | }, |
| 7849 | ) |
| 7850 | eq_( |
| 7851 | comp._create_result_map(), |
nothing calls this directly
no test coverage detected