Skip to content

Instantly share code, notes, and snippets.

@LuisArteaga
Created July 15, 2022 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LuisArteaga/a908038549ffe9a3fb989d23b7dd6264 to your computer and use it in GitHub Desktop.
Save LuisArteaga/a908038549ffe9a3fb989d23b7dd6264 to your computer and use it in GitHub Desktop.
FrostyFriday Inc., your benevolent employer, has an S3 bucket that is filled with .csv data dumps. This data is needed for analysis. Your task is to create an external stage, and load the csv files directly from that stage into a table. The S3 bucket’s URI is: s3://frostyfridaychallenges/challenge_1/ Remember if you want to participate: Sign up …
/* Setup */
USE DATABASE FROSTY_FRIDAY;
USE SCHEMA PUBLIC;
USE WAREHOUSE COMPUTE_WH;
/* Create external stage */
CREATE STAGE WEEK1_BASIC_S3_BUCKET
url = 's3://frostyfridaychallenges/challenge_1/';
/* Explore data in stage */
LIST @WEEK1_BASIC_S3_BUCKET;
SELECT $1, METADATA$FILENAME
FROM @WEEK1_BASIC_S3_BUCKET;
/* Create table */
CREATE OR REPLACE TABLE WEEK1_BASIC_TABLE
(COl1 VARCHAR);
/* Copy data from stage into table */
COPY INTO WEEK1_BASIC_TABLE
FROM @WEEK1_BASIC_S3_BUCKET;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment