Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: after data has been flattened, and header has been explicitely set, the CSV output is missing the flattened data #91

Open
emammadov-cpr opened this issue Sep 20, 2021 · 0 comments

Comments

@emammadov-cpr
Copy link

Setup:
CSVRenderer.header is set. For example renderer.header = ['a', 'b']
And the data contains

data = [{
   'a': 1,
   'b': [                      << --- this is a list of dictionaries
   {
        'c': 2
   },
   {
        'c': 3
   }]
}]

The data would get flattened producing

data = [{
   'a': 1,
  'b.0.c": 2,
  "b.1.c": 3
}]

The CSV output file would contain two columns a,b. The value for a would be 1. The value for b would be missing from CSV.
The expected output in CSV was three columns a, b.0.c, b.1.c with their respective values.

Using CSVStreamingRenderer, but I believe this doesn't matter and would apply to CSVRenderer, too.

In the case when CSVRenderer.header is not set, the default behaviour gets the keys after flattening the data, therefore it works in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant