Improve support for heterogeneous data in CSV export format

XMLWordPrintable

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major
    • Component/s: Datum Export
    • None

      Currently when exporting datum in CSV format, if the datum are heterogeneous in terms of the properties they include, then the CSV header will only include the properties of the first datum. The export does handle additional columns as they are discovered while iterating over the datum being exported, and the column order remains stable with the discovered column(s) getting added at the end, but that leaves those additional columns un-named in the header row.

      It would be nice if the CSV export could handle heterogeneous data such that the exported header row included all columns, even the additionally discovered ones found after the first datum is exported.

      For example, when exporting datum like this:

      [
        {"created":"2018-04-23T11:19:00.000Z", "watts":123},
        {"created":"2018-04-23T11:20:00.000Z", "wattHours":234},
        {"created":"2018-04-23T11:21:00.000Z", "watts":345, "status":"OK"}
      ]
      

      the expected CSV output would be like this:

      created,watts,wattHours,status
      2018-04-23T11:19:00.000Z,123
      2018-04-23T11:20:00.000Z,,234
      2018-04-23T11:21:00.000Z,245,,OK
      

            Assignee:
            Matt Magoffin
            Reporter:
            Matt Magoffin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: