Skip to content

Allow more array types for SQLite #941

Closed

Description

@dantownsend

The way we store arrays in SQLite is by converting the values to JSON strings, and then storing them in a text field.

We have this function which converts list values into JSON:

def convert_array_in(value: list):
"""
Converts a list value into a string.
"""
if value and type(value[0]) not in [str, int, float, list]:
raise ValueError("Can only serialise str, int, float, and list.")
return dump_json(value)

We validate the types here to make sure we can serialise it.

The list of types is fairly limited - it excludes Decimal, date, and datetime, because Python's json.dumps is pretty restrictive. We might be able to extend json.dumps to handle these additional types.

Note - if orjson is installed, this is less of a problem, as it serialises far more types.

Activity

  1. sinisaos commented on Feb 4, 2026

    @sinisaos
    Member

    Date / Time / Timestamp / Timestamptz is supported in SQLite since Piccolo v.1.7.0. Decimal (Numeric) remains unresolved, but I made a small PR that fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions