ikkez/f3-cortex

JSON function in SQLite

Opened this issue · 0 comments

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.