MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / validate_sql_phrase

Method validate_sql_phrase

lib/sqlalchemy/sql/compiler.py:8001–8015  ·  view source on GitHub ↗

keyword sequence filter. a filter for elements that are intended to represent keyword sequences, such as "INITIALLY", "INITIALLY DEFERRED", etc. no special characters should be present.

(self, element, reg)

Source from the content-addressed store, hash-verified

7999 return value.replace(self.escape_to_quote, self.escape_quote)
8000
8001 def validate_sql_phrase(self, element, reg):
8002 """keyword sequence filter.
8003
8004 a filter for elements that are intended to represent keyword sequences,
8005 such as "INITIALLY", "INITIALLY DEFERRED", etc. no special characters
8006 should be present.
8007
8008 """
8009
8010 if element is not None and not reg.match(element):
8011 raise exc.CompileError(
8012 "Unexpected SQL phrase: %r (matching against %r)"
8013 % (element, reg.pattern)
8014 )
8015 return element
8016
8017 def quote_identifier(self, value: str) -> str:
8018 """Quote an identifier.

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected