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?
CodePudding user response:
missing ;
after each statement maybe?
query = '''
Drop table if exists Table_Name;
create table Table_Name (
Field1 String,
Field2 Int
);
'''
cursor.execute(query)
CodePudding user response:
Please add semicolon after each query:
Drop table if exists Table_Name;
create table Table_Name ( Field1 String, Field2 Int );