MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _compose_select_body

Method _compose_select_body

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

Source from the content-addressed store, hash-verified

5258 return froms
5259
5260 def _compose_select_body(
5261 self,
5262 text,
5263 select,
5264 compile_state,
5265 inner_columns,
5266 froms,
5267 byfrom,
5268 toplevel,
5269 kwargs,
5270 ):
5271 text += ", ".join(inner_columns)
5272
5273 if self.linting & COLLECT_CARTESIAN_PRODUCTS:
5274 from_linter = FromLinter({}, set())
5275 warn_linting = self.linting & WARN_LINTING
5276 if toplevel:
5277 self.from_linter = from_linter
5278 else:
5279 from_linter = None
5280 warn_linting = False
5281
5282 # adjust the whitespace for no inner columns, part of #9440,
5283 # so that a no-col SELECT comes out as "SELECT WHERE..." or
5284 # "SELECT FROM ...".
5285 # while it would be better to have built the SELECT starting string
5286 # without trailing whitespace first, then add whitespace only if inner
5287 # cols were present, this breaks compatibility with various custom
5288 # compilation schemes that are currently being tested.
5289 if not inner_columns:
5290 text = text.rstrip()
5291
5292 if froms:
5293 text += " \nFROM "
5294
5295 if select._hints:
5296 text += ", ".join(
5297 [
5298 f._compiler_dispatch(
5299 self,
5300 asfrom=True,
5301 fromhints=byfrom,
5302 from_linter=from_linter,
5303 **kwargs,
5304 )
5305 for f in froms
5306 ]
5307 )
5308 else:
5309 text += ", ".join(
5310 [
5311 f._compiler_dispatch(
5312 self,
5313 asfrom=True,
5314 from_linter=from_linter,
5315 **kwargs,
5316 )
5317 for f in froms

Callers 1

visit_selectMethod · 0.95

Calls 12

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
rstripMethod · 0.80
joinMethod · 0.45
_compiler_dispatchMethod · 0.45
processMethod · 0.45

Tested by

no test coverage detected