Skip to content

Register converter for DataType.BIT #817

Description

@bgunebakan

DataType.BIT = 25 is defined in converter.py but no converter function is registered for it in _DEFAULT_CONVERTERS. CrateDB serialises BIT column values as Base64-encoded strings over the HTTP interface, so the raw value returned to Python is an opaque base64 string rather than a usable bit representation.

Current behaviour

CREATE TABLE t_binary (flags BIT(8))

cur.execute("SELECT flags FROM t WHERE id = 1")
row = cur.fetchone()
print(row[0])  # → 'AQID'  (raw base64)

Proposed change

Add a _to_bit_string converter that decodes the base64 bytes and returns a Python a bitarray/string representation.

Notes

This implementation is needed to implement:

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions