-
- Downloads
Mongo objects should download as JSON, not EDN (#49255) (#49322)
* Mongo objects should download as JSON, not EDN
Fixes #48198
Prior to this change, object columns (base or effective type of :type/Dictionary) were just formatted with `(str
value)` which results in a csv or json download containing EDN formatted objects.
This is a bug because we present object column values as json in the app, so the expected formatting of the download
should match this.
The formatter function now takes this type into account. As well, since this is a type of formatting that should be
always applied (even when format_rows is false), the function is modified to unconditionally apply the json/encode
formatting to dictionary types when encountered.
* add a test
* add proper condition to test
* card-download should be public
* uncomment json encoding formatter
* set-cell! should keep encoded json string for Objects
I think this is the correct change; I don't really understand the reason for wrapping, encoding, decoding, and then
string-ing that value. Maybe I'm missing something.
* Adjusted xlsx Object set-cell! implementation
* forgot the not... inverted
Co-authored-by:
adam-james <21064735+adam-james-v@users.noreply.github.com>
Showing
- modules/drivers/mongo/test/metabase/driver/mongo_test.clj 24 additions, 0 deletionsmodules/drivers/mongo/test/metabase/driver/mongo_test.clj
- src/metabase/formatter.clj 30 additions, 14 deletionssrc/metabase/formatter.clj
- src/metabase/query_processor/streaming/csv.clj 1 addition, 3 deletionssrc/metabase/query_processor/streaming/csv.clj
- src/metabase/query_processor/streaming/json.clj 1 addition, 3 deletionssrc/metabase/query_processor/streaming/json.clj
- src/metabase/query_processor/streaming/xlsx.clj 15 additions, 7 deletionssrc/metabase/query_processor/streaming/xlsx.clj
- test/metabase/api/downloads_exports_test.clj 3 additions, 1 deletiontest/metabase/api/downloads_exports_test.clj
- test/metabase/query_processor/streaming/xlsx_test.clj 12 additions, 3 deletionstest/metabase/query_processor/streaming/xlsx_test.clj
Loading
Please register or sign in to comment