Open paolobellomo opened 4 years ago
@paolobellomo can you make the title more descriptive please?
Able to reproduce the BUG in master.
def main():
sql_stmt = f"""SELECT * FROM public.pandas_test"""
print(pd.__version__)
chunk_none_df = pd.read_sql(sql_stmt, con=db_engine(), chunksize=None)
print(type(chunk_none_df))
chunk_1_df = pd.read_sql(sql_stmt, con=db_engine(), chunksize=1)
print(type(chunk_1_df))
chunk_0_df = pd.read_sql(sql_stmt, con=db_engine(), chunksize=0)
print(type(chunk_0_df))
if __name__ == "__main__":
main()
produces:
1.1.0.dev0+2073.g280efbfcc
<class 'pandas.core.frame.DataFrame'>
<class 'generator'>
<class 'generator'>
Happy to look into this if it needs to be implemented and contributions are welcome
[x] I have checked that this issue has not already been reported.
[x] I have confirmed this bug exists on the latest version of pandas.
[ ] (optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
read_sql_query: chunksize can be either None or int. The case chunksize = 0 should be treated like chunksize = None and it should return a DataFrame. At the moment it returns a generator which fails to return any object when pd.concat is used Incidentally: the DocString of read_sql_query says it will return an Iterator. Not so.
Expected Output
Output