-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: add chunksize argument to read_sql (GH2908) #8330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jorisvandenbossche
merged 1 commit into
pandas-dev:master
from
jorisvandenbossche:sql-2908-chunksize
Oct 7, 2014
+193
−51
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is their a reason this is a static_method? can u share this code with the other usage of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason is that it didn't use
self
, so I made it explicitely static. Problem is that the version is different for the two classes, so that's why I put it in the class instead of just a general helper function like_wrap_result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe make it a module level function then? (and _wrap results as well); or an use a TableIterator class and make these methods (see Pytables.py and read_csv does this too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/pydata/pandas/blob/master/pandas/io/pytables.py#L1291
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_wrap_results
is already a module level function (if I understand correctly what you mean)Problem with making it a module level function, is that I would have to make two versions of the function (see the two
_query_iterator
methods now), one for each class that uses it (PandasSQLALchemy and PandasSQLLegacy). So for that it seemed more logical to put it in the class itself.On implementing an Iterator class, I had seen the implementation in pytables, but it seemed a lot more complex than what I needed here. The simple
_query_iterator
functions seems to do all I need. Is there an advantage in making it a class?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your class would be simpler (and u could inherit methods)
and bundle wrap_results - really just preference - up 2 u
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I am going to leave it now as is, can always later look at implementing it as a class, but like to get this in