frictionlessdata / datapackage-py

A Python library for working with Data Packages.
https://frictionlessdata.io
MIT License
191 stars 43 forks source link

Improve header row handling in multipart tabular resource chunks #256

Closed paulgirard closed 4 years ago

paulgirard commented 4 years ago

Overview

A multipart resource concatenates chunks as-is which is what we want for generic binary files. But for tabular resource this default behaviour implies that if the first chunk does have one header row, the other chunks must not. We discussed this issue here: https://github.com/frictionlessdata/forum/issues/1 The proposition is to change this behaviour for tabular-data-package: tabular chunks should all have headers or none depending on dialect.header.

Implementation

Multipart chunks are handled by the _MultipartSource class which build an iterator of chunks' rows iterator. My approach is simply to discard first row of chunks (but the first) iterator when the resource is tabular with header. @roll pointed possible issues with:

@pwalsh and @akariv your points of view and advices are more than welcome.


Please preserve this line to notify @roll (lead of this repository)