mirror of
https://github.com/hanzo-ds/connect.git
synced 2026-10-30 20:31:24 +00:00
* refactor(cc_sqlalchemy): add type annotations * refactor(cc_sqlalchemy): make TableEngine inherit SchemaItem directly SchemaItem is SchemaEventTarget + Visitable formalized — TableEngine was already structurally identical but didn't declare the inheritance, causing a # type: ignore[arg-type] suppression wherever a TableEngine instance was passed to Table(). Switching to SchemaItem makes the relationship explicit and removes the suppression in alembic/impl.py. Visitable.__init__ was a no-op (delegates to object.__init__); replaced with super().__init__(). * formatting --------- Co-authored-by: Joe S <[email protected]>
16 lines
500 B
Python
16 lines
500 B
Python
from sqlalchemy.sql.compiler import IdentifierPreparer
|
|
|
|
from clickhouse_connect.driver.binding import quote_identifier
|
|
|
|
|
|
class ChIdentifierPreparer(IdentifierPreparer):
|
|
quote_identifier = staticmethod(quote_identifier) # type: ignore[assignment]
|
|
|
|
def __init__(self, dialect, **kwargs):
|
|
super().__init__(dialect, **kwargs)
|
|
if getattr(dialect, "server_side_params", False):
|
|
self._double_percents = False
|
|
|
|
def _requires_quotes(self, _value):
|
|
return True
|