Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Support streamed chunking (fixing #531 and others) #538

Closed
wants to merge 6 commits into from

Conversation

psy0rz
Copy link

@psy0rz psy0rz commented Nov 26, 2017

query() will now return a generator of ResultSets instead of a list when setting chunked=True. This might be backwards incompatible, but seems to be the only reason one might even use chunked mode?

Another reason to use chunked mode could be that the server enforces it, but then again: If results are that big, wouldn't you want a generator as well?

@psy0rz
Copy link
Author

psy0rz commented Nov 26, 2017

i'll try to fix the test as well

@psy0rz
Copy link
Author

psy0rz commented Nov 26, 2017

I think it would be cleaner to add a "stream" parameter to get a streaming response. This way we wont breakn compatibility. Perhaps there are also some usecases where someone wants to autonagically combine a chunked result in memory, like it is currently working.

…mbines the results in ONE ResultSet, instead of many) Added documentation for stream-mode. Fixed coding style issues
@psy0rz
Copy link
Author

psy0rz commented Nov 27, 2017

All set and done now. There's a new stream-parameter in query() to enable "streamed chunking". This is usefull for very large result sets. (trying to traverse and anaylse over 20 million+ results here) Also updated/added documentation in the sourcecode.

related project: https://github.com/psy0rz/meowton

@psy0rz psy0rz changed the title trying to fix #531 by returning an actual generator Support streamed chunking (fixing #531 and others) Nov 27, 2017
@xginn8
Copy link
Collaborator

xginn8 commented Nov 30, 2017

@psy0rz thank you for the patch! would you mind adding a test to this PR?

@psy0rz
Copy link
Author

psy0rz commented Nov 30, 2017

Ok will do that soonish..

@jpcbertoldo
Copy link

Hi, I believe that someone forgot to actually resolve the conflicts.

@xginn8 do you mind finishing this merge PR?

@psy0rz
Copy link
Author

psy0rz commented Oct 24, 2018

also i dont have time to add the requested regressions tests.

@aviau
Copy link
Collaborator

aviau commented Oct 24, 2018

If the author does not have the time to finish the PR then someone has to pick it up. I'll close this one and merge the other, if it is complete and includes tests.

@psy0rz
Copy link
Author

psy0rz commented Oct 24, 2018

"Potentially break the api" ;) Dont worry you can be harsh, I would apply the same policy in your case.

@aviau
Copy link
Collaborator

aviau commented Oct 24, 2018

I had picked that up from your initial comment saying it could be backwards incompatible but this is not the case due to the steam parameter.

@psy0rz
Copy link
Author

psy0rz commented Oct 24, 2018

yes, but still i could have made a mistake :)

@pedrofaria09
Copy link

Any solution for this? returning a query with millions of rows will affect memory badly.

@xiandong79
Copy link

returning a query with millions of rows is still impossible on 2019-08-01. @pedrofaria09 @aviau

@sebito91 sebito91 self-assigned this Apr 8, 2020
sebito91 pushed a commit that referenced this pull request Apr 10, 2020
When querying large data sets, it's vital to get a chunked responses to
manage memory usage. Wrapping the query response in a generator and
streaming the request provides the desired result.
It also fixes `InfluxDBClient.query()` behavior for chunked queries that
is currently not working according to
[specs](https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py#L429)

Closes #585.
Closes #531.
Closes #538.
ocworld pushed a commit to AhnLab-OSS/influxdb-python that referenced this pull request Apr 13, 2020
When querying large data sets, it's vital to get a chunked responses to
manage memory usage. Wrapping the query response in a generator and
streaming the request provides the desired result.
It also fixes `InfluxDBClient.query()` behavior for chunked queries that
is currently not working according to
[specs](https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py#L429)

Closes influxdata#585.
Closes influxdata#531.
Closes influxdata#538.
ocworld pushed a commit to AhnLab-OSS/influxdb-python that referenced this pull request Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants