How to you read a csv in SnowPark

Viewed 496

I have a bunch of .csv file and i was looking for the easiest way to load them into SnowPark? I am not sure which are the APIs required. If someone can point me to the APIs or provide a code example that will be great.

Thanks

1 Answers

I don't think you can do this directly in one step as Snowpark doesn't have an API for that. What you can do is:

Load the CSV files to a stage.

// Upload a file to a stage.
session.file.put("file:///tmp/file1.csv", "@myStage/prefix1")

Create a DataFrame by reading files from the stage.

val dfCatalog = session.read.csv("@myStage/prefix1")

See more information here and here and here

Related