# How to Load data into a Snowflake Database from AWS S3 | Learning Snowflake

> This is content from just-tim, the data-and-analytics channel by Tim Ngwena (formerly 'Tableau Tim'). Tim has 12+ years of hands-on BI experience and covers Tableau most of all, plus Power BI, Looker, Hex, SQL and data modelling, the analytics industry, and the craft of doing the job — always tool-agnostic and honest about the trade-offs.

- **Author:** Tim Ngwena (just-tim, https://just-tim.com/about)
- **Published:** 2022-11-17
- **Format:** Video · 2849 min watch · transcript available
- **Topics:** Data engineering, Data prep
- **Tools:** Snowflake (copy into, databases, file formats, schemas, stages, tables); SQL (select)
- **Canonical:** https://just-tim.com/posts/how-to-load-data-into-a-snowflake-database-from-aws-s3-learning-snowflake
- **Watch:** https://www.youtube.com/watch?v=DV8EbD9s_CM

I walk through loading data from Amazon S3 into a Snowflake database using SQL in the Snowsight interface. I cover creating a database, schema and external stage, querying files in situ, building a file format for pipe-delimited CSVs, and copying the data into a table, including all the live troubleshooting I hit along the way.

## Key takeaways

- Set up structure first: use CREATE OR REPLACE to make a database, a dedicated external staging schema, and an external stage pointing to your S3 URL (a public bucket needs no credentials, but enterprise setups require keys and encryption).
- You can query files directly in S3 without loading them by aliasing the stage and selecting positional columns (t.$1, t.$2), which lets you preview data and discover the real delimiter.
- Create a reusable named file format (TYPE = CSV, FIELD_DELIMITER = '|', SKIP_HEADER = 1) and reference it in later queries instead of re-specifying options each time.
- File formats are schema-specific: a format created in one schema isn't visible from another, and the COPY INTO context must reference fully-qualified stage paths like database.schema.stage.
- COPY INTO can load either directly from an external location or from a SELECT statement, letting you apply transformations at load time.

## Chapters

- 0:00 Intro and what we're loading
- 0:44 Planning the worksheet and S3 files
- 1:45 Creating the database and schema
- 5:01 Creating the external stage
- 6:24 Adding the S3 URL to the stage
- 9:44 Describing and listing stage files
- 12:40 Querying files directly in S3
- 20:02 Building the pipe-delimited file format
- 24:31 Applying the file format to the query
- 27:24 Creating the target table
- 33:22 COPY INTO and live troubleshooting
- 42:22 Loading via transformation at load time

Watch the full video, read the transcript and use chapter deep-links on the page: https://just-tim.com/posts/how-to-load-data-into-a-snowflake-database-from-aws-s3-learning-snowflake

---
just-tim — Data and analytics, with a point of view. · https://www.youtube.com/channel/UC7HYxRWmaNlJux-X7rNLZyw · https://twitter.com/TableauTim · https://www.linkedin.com/in/timngwena
