You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_NAMED_PARAM_RE introduced to translate %(name)s placeholders to positional $N markers, uses \w+, which matches only [a-zA-Z0-9_]. Any placeholder whose name contains a character outside that set is silently skipped: the %(...)s substring is left verbatim in the SQL string, causing CrateDB to reject the statement with a parse error.
Root cause
# src/crate/client/cursor.py, line 29_NAMED_PARAM_RE=re.compile(r"%\((\w+)\)s")
# ^^^# only matches [a-zA-Z0-9_]
re.sub silently ignores non-matching substrings. There is no warning or error when a placeholder is skipped; the driver sends broken SQL to CrateDB.
Reproduction
fromcrateimportclientascrate_clientconn=crate_client.connect("localhost:4200")
cur=conn.cursor()
# Placeholder name contains a single quote — not matched by \w+cur.execute("SELECT %(id_'bad'_)s AS v", {"id_'bad'_": 42})
# → SQLParseException: no viable alternative at input '%'
Activity