MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / quote

Method quote

lib/sqlalchemy/sql/compiler.py:8060–8086  ·  view source on GitHub ↗

Conditionally quote an identifier. The identifier is quoted if it is a reserved word, contains quote-necessary characters, or is an instance of :class:`.quoted_name` which includes ``quote`` set to ``True``. Subclasses can override this to provide database-dependent

(self, ident: str)

Source from the content-addressed store, hash-verified

8058 return self.quote(schema)
8059
8060 def quote(self, ident: str) -> str:
8061 """Conditionally quote an identifier.
8062
8063 The identifier is quoted if it is a reserved word, contains
8064 quote-necessary characters, or is an instance of
8065 :class:`.quoted_name` which includes ``quote`` set to ``True``.
8066
8067 Subclasses can override this to provide database-dependent
8068 quoting behavior for identifier names.
8069
8070 :param ident: string identifier
8071 """
8072 force = getattr(ident, "quote", None)
8073
8074 if force is None:
8075 if ident in self._strings:
8076 return self._strings[ident]
8077 else:
8078 if self._requires_quotes(ident):
8079 self._strings[ident] = self.quote_identifier(ident)
8080 else:
8081 self._strings[ident] = ident
8082 return self._strings[ident]
8083 elif force:
8084 return self.quote_identifier(ident)
8085 else:
8086 return ident
8087
8088 def format_collation(self, collation_name):
8089 if self.quote_case_sensitive_collations:

Callers 15

quote_schemaMethod · 0.95
format_collationMethod · 0.95
format_sequenceMethod · 0.95
format_labelMethod · 0.95
format_aliasMethod · 0.95
format_tableMethod · 0.95
format_schemaMethod · 0.95
format_label_nameMethod · 0.95
format_columnMethod · 0.95
_on_conflict_targetMethod · 0.45

Calls 2

_requires_quotesMethod · 0.95
quote_identifierMethod · 0.95

Tested by 1

define_tablesMethod · 0.36