tablib icon indicating copy to clipboard operation
tablib copied to clipboard

Streaming responses

Open aidanlister opened this issue 10 years ago • 5 comments

Can we use tablib to stream responses, eg have dataset.csv return a generator?

aidanlister avatar Nov 07 '15 00:11 aidanlister

This is not currently planned.

kennethreitz avatar Feb 07 '16 12:02 kennethreitz

Sorry to rehash, but would you accept a patch that implemented this support?

jarshwah avatar Mar 02 '17 04:03 jarshwah

I'm +1 for it, but it needs some design decisions. Which operations we'll be able to support for streaming imports and exports?

I know openpyxl has optimized reader/writer (http://openpyxl.readthedocs.io/en/default/optimized.html) and it is really useful.

Reopening the issue for discussion. I think it is possible to make it in tablib.

iurisilvio avatar Mar 02 '17 12:03 iurisilvio

Hello @iurisilvio @jarshwah @kennethreitz

A lot of formats use file-like object but export_set returns stream.getvalue() to get a string. So my proposition is the following:

  • Add the function export_stream_set to the possible ones
  • Update export_set to use the export_stream_set and launch .getvalue() to get a string.

I think we could gain in features just by split code in several functions. And I really need to be able to work with streams :D

What do you think about ?

ZuluPro avatar Aug 08 '18 11:08 ZuluPro

POC here: #337

ZuluPro avatar Aug 08 '18 14:08 ZuluPro