Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support arrays of timestamp / timestamptz / date / time in SQLite #1003

Closed
dantownsend opened this issue May 31, 2024 · 0 comments · Fixed by #1004
Closed

Support arrays of timestamp / timestamptz / date / time in SQLite #1003

dantownsend opened this issue May 31, 2024 · 0 comments · Fixed by #1004
Labels
enhancement New feature or request

Comments

@dantownsend
Copy link
Member

dantownsend commented May 31, 2024

We don't currently support things like this in SQLite:

class MyTable(Table):
    times = Array(Time())

SQLite doesn't have native support for array columns. The way we support it in Piccolo is by serialising the array into a string before storing it in the database, and deserialising it again when querying the row.

We use JSON to do the serialisation / deserialisation, which doesn't support datetime / date / time out of the box.

To support this, we'll need to create new row types for SQLite - like ARRAY_TIME / ARRAY_TIMESTAMP etc. When we read data from a row with this column type, we know we need to deserialise the values back into a list of Python objects.

One of the reasons we need this functionality is because we're doing a lot of improvements to arrays in Piccolo Admin, and we often test on SQLite.

@dantownsend dantownsend added the enhancement New feature or request label May 31, 2024
@dantownsend dantownsend added this to To do in Enhancements via automation May 31, 2024
Enhancements automation moved this from To do to Done May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

1 participant