MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / visit_table

Method visit_table

lib/sqlalchemy/sql/compiler.py:5554–5606  ·  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,
        within_tstring=False,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

5552 return text
5553
5554 def visit_table(
5555 self,
5556 table,
5557 asfrom=False,
5558 iscrud=False,
5559 ashint=False,
5560 fromhints=None,
5561 use_schema=True,
5562 from_linter=None,
5563 ambiguous_table_name_map=None,
5564 enclosing_alias=None,
5565 within_tstring=False,
5566 **kwargs,
5567 ):
5568 if from_linter:
5569 from_linter.froms[table] = table.fullname
5570
5571 if asfrom or ashint or within_tstring:
5572 effective_schema = self.preparer.schema_for_object(table)
5573
5574 if use_schema and effective_schema:
5575 ret = (
5576 self.preparer.quote_schema(effective_schema)
5577 + "."
5578 + self.preparer.quote(table.name)
5579 )
5580 else:
5581 ret = self.preparer.quote(table.name)
5582
5583 if (
5584 (
5585 enclosing_alias is None
5586 or enclosing_alias.element is not table
5587 )
5588 and not effective_schema
5589 and ambiguous_table_name_map
5590 and table.name in ambiguous_table_name_map
5591 ):
5592 anon_name = self._truncated_identifier(
5593 "alias", ambiguous_table_name_map[table.name]
5594 )
5595
5596 ret = ret + self.get_render_as_alias_suffix(
5597 self.preparer.format_alias(None, anon_name)
5598 )
5599
5600 if fromhints and table in fromhints:
5601 ret = self.format_from_hint_text(
5602 ret, table, fromhints[table], iscrud
5603 )
5604 return ret
5605 else:
5606 return ""
5607
5608 def visit_join(self, join, asfrom=False, from_linter=None, **kwargs):
5609 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