Files
bec10356fe refactor(cc_sqlalchemy): add type annotations to pass mypy (part of #692) (#807)
* 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]>
2026-06-22 16:02:25 -07:00

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