MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _compose_select_body

Method _compose_select_body

lib/sqlalchemy/sql/compiler.py:5061–5154  ·  view source on GitHub ↗
(
        self,
        text,
        select,
        compile_state,
        inner_columns,
        froms,
        byfrom,
        toplevel,
        kwargs,
    )

Source from the content-addressed store, hash-verified

5059 return froms
5060
5061 def _compose_select_body(
5062 self,
5063 text,
5064 select,
5065 compile_state,
5066 inner_columns,
5067 froms,
5068 byfrom,
5069 toplevel,
5070 kwargs,
5071 ):
5072 text += ", ".join(inner_columns)
5073
5074 if self.linting & COLLECT_CARTESIAN_PRODUCTS:
5075 from_linter = FromLinter({}, set())
5076 warn_linting = self.linting & WARN_LINTING
5077 if toplevel:
5078 self.from_linter = from_linter
5079 else:
5080 from_linter = None
5081 warn_linting = False
5082
5083 # adjust the whitespace for no inner columns, part of #9440,
5084 # so that a no-col SELECT comes out as "SELECT WHERE..." or
5085 # "SELECT FROM ...".
5086 # while it would be better to have built the SELECT starting string
5087 # without trailing whitespace first, then add whitespace only if inner
5088 # cols were present, this breaks compatibility with various custom
5089 # compilation schemes that are currently being tested.
5090 if not inner_columns:
5091 text = text.rstrip()
5092
5093 if froms:
5094 text += " \nFROM "
5095
5096 if select._hints:
5097 text += ", ".join(
5098 [
5099 f._compiler_dispatch(
5100 self,
5101 asfrom=True,
5102 fromhints=byfrom,
5103 from_linter=from_linter,
5104 **kwargs,
5105 )
5106 for f in froms
5107 ]
5108 )
5109 else:
5110 text += ", ".join(
5111 [
5112 f._compiler_dispatch(
5113 self,
5114 asfrom=True,
5115 from_linter=from_linter,
5116 **kwargs,
5117 )
5118 for f in froms

Callers 1

visit_selectMethod · 0.95

Calls 10

default_fromMethod · 0.95
warnMethod · 0.95
group_by_clauseMethod · 0.95
order_by_clauseMethod · 0.95
_row_limit_clauseMethod · 0.95
for_update_clauseMethod · 0.95
FromLinterClass · 0.85
joinMethod · 0.45
_compiler_dispatchMethod · 0.45

Tested by

no test coverage detected