Can I send a CREATE TABLE statement to SQL DBs via the dataiku Python package?

akshaykatre
Level 1
Can I send a CREATE TABLE statement to SQL DBs via the dataiku Python package?

Hi everyone, 

 

I'm trying to launch a create table query onto a SQL DB and I want to use the Dataiku Python API package to do that; 

I tried the following: 

executor = SQLExecutor2(connection=cInfo['connectionName'])
x = executor.query_to_df('create table X(var1 int); select 1 as ready;')

I couldn't find a method in the package that let me run a query on a server without expecting a return value. 

I'm looking for something on the lines of execute with the pyodbc python package, if its available. 

 

Thanks in advance,

Akshay

 

 

0 Kudos
1 Reply
Marlan

Hi @akshaykatre,

Yes, this is possible. An approach similar to what you propose worked for me on a couple of different SQL platforms. More information in this post.

Marlan