(
self, cs, asfrom=False, compound_index=None, **kwargs
)
| 3030 | return func.clause_expr._compiler_dispatch(self, **kwargs) |
| 3031 | |
| 3032 | def visit_compound_select( |
| 3033 | self, cs, asfrom=False, compound_index=None, **kwargs |
| 3034 | ): |
| 3035 | toplevel = not self.stack |
| 3036 | |
| 3037 | compile_state = cs._compile_state_factory(cs, self, **kwargs) |
| 3038 | |
| 3039 | if toplevel and not self.compile_state: |
| 3040 | self.compile_state = compile_state |
| 3041 | |
| 3042 | compound_stmt = compile_state.statement |
| 3043 | |
| 3044 | entry = self._default_stack_entry if toplevel else self.stack[-1] |
| 3045 | need_result_map = toplevel or ( |
| 3046 | not compound_index |
| 3047 | and entry.get("need_result_map_for_compound", False) |
| 3048 | ) |
| 3049 | |
| 3050 | # indicates there is already a CompoundSelect in play |
| 3051 | if compound_index == 0: |
| 3052 | entry["select_0"] = cs |
| 3053 | |
| 3054 | self.stack.append( |
| 3055 | { |
| 3056 | "correlate_froms": entry["correlate_froms"], |
| 3057 | "asfrom_froms": entry["asfrom_froms"], |
| 3058 | "selectable": cs, |
| 3059 | "compile_state": compile_state, |
| 3060 | "need_result_map_for_compound": need_result_map, |
| 3061 | } |
| 3062 | ) |
| 3063 | |
| 3064 | if compound_stmt._independent_ctes: |
| 3065 | self._dispatch_independent_ctes(compound_stmt, kwargs) |
| 3066 | |
| 3067 | keyword = self.compound_keywords[cs.keyword] |
| 3068 | |
| 3069 | text = (" " + keyword + " ").join( |
| 3070 | ( |
| 3071 | c._compiler_dispatch( |
| 3072 | self, asfrom=asfrom, compound_index=i, **kwargs |
| 3073 | ) |
| 3074 | for i, c in enumerate(cs.selects) |
| 3075 | ) |
| 3076 | ) |
| 3077 | |
| 3078 | kwargs["include_table"] = False |
| 3079 | text += self.group_by_clause(cs, **dict(asfrom=asfrom, **kwargs)) |
| 3080 | text += self.order_by_clause(cs, **kwargs) |
| 3081 | if cs._has_row_limiting_clause: |
| 3082 | text += self._row_limit_clause(cs, **kwargs) |
| 3083 | |
| 3084 | if self.ctes: |
| 3085 | nesting_level = len(self.stack) if not toplevel else None |
| 3086 | text = ( |
| 3087 | self._render_cte_clause( |
| 3088 | nesting_level=nesting_level, |
| 3089 | include_following_stack=True, |
nothing calls this directly
no test coverage detected