简体   繁体   中英

Load csv file into SnowFlake table using python

I am trying to upload csv files from Python into Snowflake.

Here is my code:

drop stage if exists "SCHEMA"."DATABASE".data_stage

create stage "SCHEMA"."DATABASE".data_stage file_format = (type = "csv" field_delimiter = "," skip_header = 1)

put file://C://Users//318459//Downloads//Student_marks.csv @DATA_STAGE auto_compress=true

I dont have access to other ways to upload the files into my snowflake server,

I already connected python and I can create sql scripts, but show me an error with the last line "put file". Any idea? I tried to run this directly into snowflake and this is the error.

ERROR:

SQL compilation error: The command is not supported from the UI: PUT

Regards

put command cannot be used in UI as the error message states, you can use it within python though.

Also, you don't need to create a stage for this purpose, you can either use user or table stages. They are stages already exist, for more info: Types of Stages

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM