Created
July 15, 2022 10:42
-
-
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 …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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