Fix frozen delta watermark and add error stats, lazy source, concurrent disk reads, and per-engine config

This commit is contained in:
Jan Doubravský
2026-06-08 19:35:33 +02:00
parent 209ae667ab
commit 6dc85e4f3c
17 changed files with 668 additions and 71 deletions
+27
View File
@@ -0,0 +1,27 @@
"""SQL identifier quoting.
Table and column names are interpolated into statements as raw strings, so a
name with a space, a reserved word, or an embedded quote would break the query
(and is a latent injection vector). These helpers quote identifiers safely. The
in-memory cache is SQLite, so it uses double-quote style; the source DB is quoted
in its configured dialect (e.g. T-SQL ``[brackets]``).
"""
from collections.abc import Iterable
from sqlglot import exp
def quote(name: str) -> str:
"""Quote an identifier for the in-memory SQLite cache."""
return '"' + name.replace('"', '""') + '"'
def quote_list(names: Iterable[str]) -> str:
"""Comma-join SQLite-quoted identifiers."""
return ", ".join(quote(n) for n in names)
def quote_source(name: str, dialect: str) -> str:
"""Quote an identifier for the source DB in its dialect (e.g. T-SQL ``[x]``)."""
return exp.to_identifier(name, quoted=True).sql(dialect=dialect)