petl-developers / petl

Python Extract Transform and Load Tables of Data
MIT License
1.25k stars 193 forks source link

Examples of valid and invalid usage of generator as table container #642

Open ewelkaw opened 1 year ago

ewelkaw commented 1 year ago

This PR has the objective of providing some more examples of valid and invalid usage of generator as table container.

Changes

  1. Improved the docs about usage of generators as data containers
bmaggard commented 1 year ago

Please reject this PR. valid_container_generator is not a valid table container.

Other considerations:

  1. batched is something that can be imported from more_itertools, not itertools.
  2. The documentation is already clear about what table containers and table iterators are. ("each subsequent item returned by the iterator is a data row comprising a sequence of data values")
  3. We cannot and should not be documenting all the things table containers/iterators are not,
  4. An example of what is not a table container (csv.reader()) is already provided.
  5. The yielded data_row is actually first a header row, then data rows.