Uploading Data
Updated Mar 06, 2025 ·
Uploading CSV Data
In this guide, we’ll upload a CSV file from a local computer to Snowflake.
Steps:
-
Prepare the CSV file.
-
Create a table in Snowflake to store the data.
-
Upload the file:
- Go to Snowsight → Data → Load Data.
- Select the CSV file from your computer.
- Choose the target database, schema, and table.
- Follow the steps to complete the upload.
-
Check if the data was loaded successfully.
Additional Features:
- File formats: Snowflake supports different delimiters (e.g., commas, tabs).
- Error handling: Review error logs if any rows fail to load.
- Automate uploads: Use Snowflake's
PUT
andCOPY INTO
commands for bulk uploads.
See below:
Loading Data from a Cloud Provider
Snowflake can connect to cloud storage services to load data for analysis. This process involves setting up an external stage, granting permissions, and loading data into a table.
High-Level Workflow
- Data is stored in a cloud provider's folder.
- Create the storage integration.
- Create the stage to access the folder.
- Refresh the stage.
- Reference the stage when creating the table.
- Load data into table.
Setting Up Stage Permissions
- Grant access: The cloud provider must allow Snowflake to read files.
- Storage integration: Snowflake uses this to store cloud credentials securely.
- Create a stage: The stage references the storage integration and folder URL.
Example (AWS S3):
CREATE STORAGE INTEGRATION my_s3_integration
TYPE = EXTERNAL_STAGE
STORAGE_PROVIDER = 'S3'
STORAGE_AWS_ROLE_ARN = 'arn:aws:iam::123456789012:role/my-s3-role';
CREATE STAGE my_stage
STORAGE_INTEGRATION = my_s3_integration
URL = 's3://my-bucket/data/';
Using the External Stage
- Refresh the stage: View available files in Snowsight.
- Check stage details: See cloud region, file path, and owner.
- Load data into a table:
CREATE TABLE customer_signups (
id INT,
name STRING,
signup_date DATE
);
COPY INTO customer_signups
FROM @my_stage
FILE_FORMAT = (TYPE = 'CSV');
Verifying the Data
Run a query to check the imported records:
SELECT * FROM customer_signups LIMIT 5;