Reputation: 3
I can successfully execute each query individually, and can run multiple in the databricks environment, However I can not get it to work for a multi-query statement through Databricks SQL Connector for Python. Piece of the python below;
query = '''
Drop table if exists Table_Name
create table Table_Name (
Field1 String,
Field2 Int
)
'''
cursor.execute(query)
Which will give the following error;
mismatched input 'create' expecting
Are Multi-query statements possible, if so what am I missing?
Upvotes: 0
Views: 1577
Reputation: 24613
missing ;
after each statement maybe?
query1 = '''Drop table if exists Table_Name; '''
query2= '''
create table Table_Name (
Field1 String,
Field2 Int
);
'''
cursor.execute(query1)
cursor.execute(query2)
Upvotes: 0
Reputation: 1730
Please add semicolon after each query:
Drop table if exists Table_Name;
create table Table_Name ( Field1 String, Field2 Int );
Upvotes: 0