Error while compiling statement: FAILED: ParseException line 1:84 missing EOF at

1k Views Asked by At

Using Cloudera Data Science Workbench, python 2 session i am calling a .sql file :

Changing tables names for security:
DROP TABLE IF EXISTS database1.table1 ;

CREATE TABLE IF NOT EXISTS database1.table1 ;
AS Select tb.column1
FROM database2.table2 as tb lIMIT 10

The queries execute fine in HUE but i get the following error when I call them from pyhive

Pyhs2Exception:
 "Error while compiling statement: FAILED: ParseException line 1:84 missing EOF at ';' 

My guess is i have have to execute two separate statements when using pyhive, is there a way to combine sql statements when executing one cursor?

here is the cursor part from python, it works fine calling each of the statements if i run them alone" the drop or create statements":

cursor = conn.cursor()
cursor.execute((open("sandbox/test2_table_create.sql").read()))
1

There are 1 best solutions below

0
On BEST ANSWER

It believe there is not a way to execute multiple SQL commands in one execute statement using Impyla.