0

It appears when using Python's impala.dbapi connect, you can only run one command per execute. I am using Python 2.7.

I would like to create two common table expressions then join them, but I am unable to get this to work.

If I run the SQL as it would work in HUE using Impala it fails because only one command can be run per execute.

If I create the common table expressions in two separate executes in python and try to join the two CTEs in a third execute I get error unable to resolve "cte..." it appears the CTE does not stay in memory after the first execute is complete. The work around has been to create temporary tables in Impala instead of using CTEs. Eventually I will use Spark data frames and join those, but a permission issue is preventing Spark API from reading from Impala tables for the near future.

Graham
  • 7,431
  • 18
  • 59
  • 84
Brian DS
  • 51
  • 9

1 Answers1

0

Based on the tests I have conducted it does not appear to be possible to use common table expressions with Python 2.7 using impala.dbapi. This is because the CTEs do not stay in memory with subsequent cursor.execute commands, and running two SQL commands in one cursor.execute instance returns an error.

Brian DS
  • 51
  • 9