Skip to content
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

Support for pandas _query_iterator #145

Open
TomAugspurger opened this issue Mar 18, 2015 · 0 comments
Open

Support for pandas _query_iterator #145

TomAugspurger opened this issue Mar 18, 2015 · 0 comments
Milestone

Comments

@TomAugspurger
Copy link

It would be nice if this worked:

gen = pd.read_sql_query(complex_sql, engine, chunksize=10)
odo.into('data.hdf5::/test', gen)

Right now I don't think odo is aware that gen, a _query_iterator is just an iterator of DataFrames. You get back that _query_iterator from pd.read_sql_table or pd.read_sql_query when you specify a chunksize.

I used a workaround Matthew suggested on the mailing list

def f():
    gen = pd.read_sql_query(complex_sql, engine, chunksize=10)
    for df in gen:
        yield df

odo.into('data.hdf5::/test', odo.chunks(pd.DataFrame)(f))

For testing, this doesn't even need to be a complex query, you can just use pd.read_sql_table with a chunksize.

@cpcloud cpcloud added this to the 0.3.2 milestone Mar 21, 2015
@cpcloud cpcloud modified the milestones: 0.3.2, 0.3.3 Apr 17, 2015
@cpcloud cpcloud modified the milestones: 0.3.3, 0.3.4 Jul 1, 2015
@cpcloud cpcloud modified the milestones: 0.3.4, 0.4.0 Sep 15, 2015
@cpcloud cpcloud modified the milestones: 0.4.0, 0.3.5 Oct 5, 2015
@cpcloud cpcloud modified the milestones: 0.4.0, 0.4.1 Dec 4, 2015
@kwmsmith kwmsmith modified the milestones: 0.4.1, 0.4.2, 0.5.0 Feb 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants