-
Notifications
You must be signed in to change notification settings - Fork 106
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
Poor performance when using pandas.read_sql #222
Comments
laughingman7743
added a commit
that referenced
this issue
Apr 4, 2021
laughingman7743
added a commit
that referenced
this issue
Apr 4, 2021
@rpkilby Thanks! |
I am encountering problems while using pandas.read_sql or pandas.read_sql_query, and it is giving an error message as text. error: |
@chauhan-26 Please register a new issue if possible. A more detailed stack trace may help to resolve the cause. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @laughingman7743, I've noticed that
pyathena
+pandas.read_sql
can exhibit poor performance when the query statement exceeds 255 characters in length, and that this can be fixed by instead callingpandas.read_sql_query
directly.The issue is that while
read_sql
is just a wrapper forread_sql_query
andread_sql_table
, the way it determines which method to call is through ahas_table
check on the query statement, which ultimately callsget_columns
. It's this call that's problematic, and in our case adding a consistent ~1 minute delay to the query. There are a few compounding factors:I'm not really sure what the correct fix is here.
read_sql
probably shouldn't be doing the table check, however the poor performance is the result of our database setup combined with pyathena's retry policy.My solution is to just call
read_sql_query
directly, but as a relatively novice pandas user, I wasn't aware of what was happening since it'sread_sql
that's usually recommended or used in tutorials/sample code. Thanks.The text was updated successfully, but these errors were encountered: