metabase / metabase

The simplest, fastest way to get business intelligence and analytics to everyone in your company :yum:
https://metabase.com
Other
37.28k stars 4.95k forks source link

Download as JSON converts Pg array columns to strings instead of JSON arrays #9608

Open tsibley opened 5 years ago

tsibley commented 5 years ago

I'm using Metabase 0.31.2 (Docker + H2) pointed at PostgreSQL 10. It's really nice to use, thanks!

When downloading question results as JSON, array-typed columns are converted to strings (using Pg's native string representation of arrays) instead of native JSON arrays.

This appears to affect arrays of all types (text, integer, etc) and is reproducible with:

select array['foo', 'bar', 'baz'] as array_column
lindsay-stevens commented 5 years ago

Assuming #708 was implemented and covered proper serialisation, could you live with having to cast your regular arrays to JSON arrays (if Metabase didn't do this automagically)?

tsibley commented 5 years ago

That would be mildly annoying, but ok. Is there a reason in particular it might be hard to handle the native array types?

lindsay-stevens commented 5 years ago

I don't know about the difficulty of it, but I asked because JSON is a reasonably compatible composite type and ticket 708 is 2nd highest 👍 voted out of ~2k. So probably it would be the most feasible approach for a while, unless a community member were to implement array handling.

gtaylor commented 4 years ago

Is there a way to work around this for now? Was just running into the unexpected stringification for a tag field I have.