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

Method visit_table

lib/sqlalchemy/sql/compiler.py:5350–5401  ·  view source on GitHub ↗
(
        self,
        table,
        asfrom=False,
        iscrud=False,
        ashint=False,
        fromhints=None,
        use_schema=True,
        from_linter=None,
        ambiguous_table_name_map=None,
        enclosing_alias=None,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

5348 return text
5349
5350 def visit_table(
5351 self,
5352 table,
5353 asfrom=False,
5354 iscrud=False,
5355 ashint=False,
5356 fromhints=None,
5357 use_schema=True,
5358 from_linter=None,
5359 ambiguous_table_name_map=None,
5360 enclosing_alias=None,
5361 **kwargs,
5362 ):
5363 if from_linter:
5364 from_linter.froms[table] = table.fullname
5365
5366 if asfrom or ashint:
5367 effective_schema = self.preparer.schema_for_object(table)
5368
5369 if use_schema and effective_schema:
5370 ret = (
5371 self.preparer.quote_schema(effective_schema)
5372 + "."
5373 + self.preparer.quote(table.name)
5374 )
5375 else:
5376 ret = self.preparer.quote(table.name)
5377
5378 if (
5379 (
5380 enclosing_alias is None
5381 or enclosing_alias.element is not table
5382 )
5383 and not effective_schema
5384 and ambiguous_table_name_map
5385 and table.name in ambiguous_table_name_map
5386 ):
5387 anon_name = self._truncated_identifier(
5388 "alias", ambiguous_table_name_map[table.name]
5389 )
5390
5391 ret = ret + self.get_render_as_alias_suffix(
5392 self.preparer.format_alias(None, anon_name)
5393 )
5394
5395 if fromhints and table in fromhints:
5396 ret = self.format_from_hint_text(
5397 ret, table, fromhints[table], iscrud
5398 )
5399 return ret
5400 else:
5401 return ""
5402
5403 def visit_join(self, join, asfrom=False, from_linter=None, **kwargs):
5404 if from_linter:

Callers

nothing calls this directly

Calls 7

_truncated_identifierMethod · 0.95
format_from_hint_textMethod · 0.95
format_aliasMethod · 0.80
schema_for_objectMethod · 0.45
quote_schemaMethod · 0.45
quoteMethod · 0.45

Tested by

no test coverage detected