Dharma Prakash
Dharma Prakash

Reputation: 13

File format creation using Python in Snowflake

We are using python for data load so we need to create file format in snowflake using python. I have tried to creating file format through python but it got error out.

Could someone please share the sample python script for creating file format using python.

Upvotes: 0

Views: 488

Answers (1)

Sriga
Sriga

Reputation: 1321

You can execute your file format DDL statement via Python cursor.

snowflake.connector as sfc

# --Snowflake Connection Setup
cnx = sfc.connect(
user='user',
password=pwd,
account='account',
warehouse = 'warehouse',
database='database',
schema='schema',
role = 'role')
cnx.cursor().execute("create or replace file format mycsvformat type = 'CSV' 
field_delimiter '|' skip_header = 1;")

Upvotes: 0

Related Questions