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
DataType.BIT = 25 is defined in converter.py, but no converter function is registered for it in _DEFAULT_CONVERTERS. BIT values therefore fall through _to_default unchanged and reach Python as CrateDB's B'…' SQL literal form, which cannot be fed back to the server as a parameter, making the read/write round-trip asymmetric.
Current behaviour
CREATETABLEt_bit (id INT, flags BIT(8));
cur.execute("INSERT INTO t_bit (id, flags) VALUES (1, ?)", ("00000001",)) # bare bitscur.execute("SELECT flags FROM t_bit WHERE id = 1")
value=cur.fetchone()[0]
print(value) # -> "B'00000001'" (literal wrapper, not what was written)
The value that comes out is not accepted going back in:
cur.execute("INSERT INTO t_bit (id, flags) VALUES (2, ?)", (value,))
# ProgrammingError: SQLParseException[Cannot cast value `B'00000001'` to type `bit(8)`]cur.execute("SELECT count(*) FROM t_bit WHERE flags = ?", (value,))
# ProgrammingError: SQLParseException[Cannot cast value `B'00000001'` to type `bit(8)`]
Proposed change
Register a _to_bit_string converter for DataType.BIT that strips the literal wrapper and returns the bare bit string.
Activity