0
votes

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.

1
Could you provide what you tried and what did not work with it? - Mike Walton

1 Answers

0
votes

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;")