Skip to content

Tables header configuration for both writing and reading #16

@starboy1407

Description

@starboy1407

Currently there exists a 'ignore_header' and 'header' parameter in reader and writer. The user needs to use 'ignore_parameter' in reading the table where he can include a header or exclude it.
Same goes for writing keywords but 'ignore_header' is not intuitive since it could mean that you write a table and 'ignore_header' could either mean you ignore the 0st element in writing a table or you exclude it inside your own data. This is why header parameter came in place.

However having 2 different variables doing almost the same there must be a common ground to have a single variable/keyword/parameter to determine both writing and reading.

We have 4 situations:

  1. Table has a header: I want to read/write with header included
  2. Table has a header: I want to read/write without header
  3. Table has no header: I want to read/write with header included
  4. Table has no header: I want to read/write without header

If I want a single header variable where I want to read using column names (situation 1) but also write only data (situation 2) the conditions are different but with the same goal that headers are included.
One solution could be auto detection of header if we don't know if table has a header or not.

One of the solutions could be creating multiple enum options for reading/writing: include, exclude/skip, auto
Example:

Code Output
configure_header(include) Reading a table would read the complete table (With header or not). Writing a table would allow to change the 0th index with header or without
configure_header(exclude) Reading table would automatically search for header and exclude it. Making 0th index data. Same applies to writing it.
configure_header(auto) (default) Reading table would automatically go to 'include', since most of the time the user wants to read with columns. Writing however would go to 'exclude' and only work with data and skips the possible header.

Bonus points if configure_header could also have scope like
Test 1:
configure_header(state=exclude, scope=test)
read table
write table

Test 2:
// jumps back to 'auto' state
read table
write table

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions