You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/07/29 03:03:11 UTC

[GitHub] john-bodley opened a new pull request #5517: [get_df] Updating multi-statement logic

john-bodley opened a new pull request #5517: [get_df] Updating multi-statement logic
URL: https://github.com/apache/incubator-superset/pull/5517
 
 
   This PR fixes an issue we've been running into with multi-statements in Presto which is asynchronous. When using the cursor associated with a raw connection using multiple statements in a synchronous manner, i.e.,  
   ```
   cursor = engine.raw_connection().cursor()
   cursor.execute(...)
   cursor.execute(...)
   ```
   for Presto it wouldn't poll to check that the first statement had finished before executing the second. It seems that some DB-API's have the `nextset` method (though this isn't universal) but reading through code snippets it seems the best way to ensure that multi-statements execute sequentially for all engine types is to simply call `fetchall` from the cursor which waits until the statement is done, i.e., [here's](https://github.com/dropbox/PyHive/blob/master/pyhive/common.py#L105) the logic for Presto.
   
   Note that when using the `sqlalchemy.engine.base.Connection` (without a cursor) the following would work (though I'm not sure why):
   ```
   conn = engine.connect()
   conn.execute(...)
   conn.execute(...)
   ```
   However this approach isn't via use the cursor to execute queries via `db_engine_spec.execute`. 

----------------------------------------------------------------
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

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org