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)
| 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: |