Hi,
I've loaded up a SQLite database, where the column named Payload
are identified as a field containing JSON:
I understand that Metabase does not support unfolding JSON with SQLite. That I don't really understand, but that's for another day.
I noticed that regexextract
are a thing, but sadly, SQLite are not supported there, too.
Going the SQL route
I know it's possible to just use the json_extract function from SQLite, so a query like json_extract(payload, '$.referer') as "referer"
can do it for me.
However, that implements some limitations of using Metabase with a cool date selector, and stuff like that:
I know it's possible to use a query like:
[AND DATETIME("activity"."created_ts", 'unixepoch') BETWEEN DATETIME(coalesce(cast({{DateStart}} as date), cast(getdate()-999999 as Date) )) AND DATETIME(coalesce(cast({{DateEnd}} as date), cast(getdate() as Date) ))
But, with that kind of solution, the user needs to select both at "DateStart" and "DateEnd", instead of the awesome "adaptive" date selector which normally are provided in Metabase.
The great "All options" Time
-Filter type cannot be used here.
Unable to escape " character
I also noticed that it should be possible to make a custom expression, doing most of the job, however, I', unable to escape the "
character.
I tried thinks like this: replace(substring(replace(lower(trim([Payload])), " ", ""), 1, 32), "\"", "")
But also things like """, "" and similar.
Next step
Now I'd like to ask here, to see if some of you have a good suggestion on how to going forward with this.
See the next post, where I'm touching the "Field Filters" option, but are unable to add Metadata (Foreign key), as I cannot use variables in a Model.