Skip to content

JSON function in SQLite #116

@marcus-at-localhost

Description

@marcus-at-localhost

I'm using f3-schema-builder and f3-cortex to create temporary SQLite database for API data.
Right now, I'm just storing the JSON string and then pull it out and access JSON fields with PHP.
But I need to query and aggregate the JSON more precisely, and SQLite seems to support that now:
https://www.delphitools.info/2021/06/17/sqlite-as-a-no-sql-database/
https://www.sqlite.org/json1.html

How could I use this in F3 and keep some benefits of f3-cortex/schema-builder or do I have to go raw SQL for anything JSON related?

If I set up Cortex this way: https://github.com/ikkez/f3-cortex#set-up how can I add an index like this:
create index test_extract_vx_idx on test(json_extract(data, '$.vx')) ? Just raw SQL?

Is it possible to extend Cortex to my special needs? Or do I have to overwrite too many methods?

Thanks for any hints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions