You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2018/04/20 00:47:42 UTC

[GitHub] john-bodley opened a new pull request #4853: [sql] Using read_sql_query instead of read_sql

john-bodley opened a new pull request #4853: [sql] Using read_sql_query instead of read_sql
URL: https://github.com/apache/incubator-superset/pull/4853
 
 
   The Pandas [read_sql](https://github.com/pandas-dev/pandas/blob/v0.22.0/pandas/io/sql.py#L335-L416) method either reads a SQL query _or_ a database table (we require only the former) into a DataFrame. This results in an additional query (for non-SQLite databases) to determine whether the `sql` object represents a SQL query or table name. This is unnecessary as the `sql` object is always a SQL statement when called from `get_df`. 
   
   This PR uses the [read_sql_query](https://github.com/pandas-dev/pandas/blob/v0.22.0/pandas/io/sql.py#L273-L332) method instead which merely reads the SQL query into a DataFrame thus saving us executing an unnecessary statement.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services