From a138b4a95852b0d7be0a6cc653372d598d1d61dd Mon Sep 17 00:00:00 2001 From: natewardwell Date: Thu, 12 Sep 2024 10:00:39 -0400 Subject: [PATCH 1/2] Create setup_sample_data.sql --- .../setup_sample_data.sql | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 samples/hightouch_quickstart_data/setup_sample_data.sql diff --git a/samples/hightouch_quickstart_data/setup_sample_data.sql b/samples/hightouch_quickstart_data/setup_sample_data.sql new file mode 100644 index 0000000..f98bff5 --- /dev/null +++ b/samples/hightouch_quickstart_data/setup_sample_data.sql @@ -0,0 +1,51 @@ +// Set context with appropriate privileges +USE ROLE PC_HIGHTOUCH_ROLE; +USE DATABASE PC_HIGHTOUCH_DB; +USE SCHEMA PUBLIC; +// Create tables for demo +CREATE TABLE IF NOT EXISTS events ( + user_id VARCHAR(16777216), + product_id VARCHAR(16777216), + event_type VARCHAR(16777216), + timestamp DATE, + quantity INT, + price NUMBER(38,2), + category VARCHAR(16777216) +); +CREATE TABLE IF NOT EXISTS users ( + id VARCHAR, + first_name VARCHAR(16777216), + last_name VARCHAR(16777216), + email VARCHAR(16777216), + gender VARCHAR(16777216), + birthday DATE, + city VARCHAR(16777216), + state VARCHAR(16777216), + phone VARCHAR(16777216) +); + +// Create file format +CREATE OR REPLACE FILE FORMAT mycsvformat + TYPE = 'CSV' + FIELD_DELIMITER = ',' + SKIP_HEADER = 1; + +// Create external stage +CREATE OR REPLACE STAGE my_csv_stage + FILE_FORMAT = mycsvformat + URL = 's3://snow-ht-hol' credentials=(AWS_KEY_ID='AKIAXBUYSSFICPVETY4O' AWS_SECRET_KEY='ud/lrc0Hcr0+T4xnkMTW74yzST2GinST3cZG2/I7') ; + +// Run COPY INTO commands to load .csvs into Snowflake +COPY INTO events +FROM @my_csv_stage/snowflake_hol_events.csv +FILE_FORMAT = (TYPE = CSV) +ON_ERROR = 'continue'; + +COPY INTO users +FROM @my_csv_stage/snowflake_hol_users.csv +FILE_FORMAT = (TYPE = CSV) +ON_ERROR = 'continue'; + +// Option to test tables +select * from events; +select * from users; From 0f38eb35ea2e6377d70635ba3a8fa959418fa8b2 Mon Sep 17 00:00:00 2001 From: natewardwell Date: Thu, 12 Sep 2024 10:02:52 -0400 Subject: [PATCH 2/2] Create README.md --- samples/hightouch_quickstart_data/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 samples/hightouch_quickstart_data/README.md diff --git a/samples/hightouch_quickstart_data/README.md b/samples/hightouch_quickstart_data/README.md new file mode 100644 index 0000000..355b7ca --- /dev/null +++ b/samples/hightouch_quickstart_data/README.md @@ -0,0 +1,9 @@ +This file is used to set up data for this Hightouch-Snowflake quickstart: https://quickstarts.snowflake.com/guide/hightouch_cdp/index.html?index=../..index#0 + +Instructions for this step of setup: + +Download the SQL file file. +Within Snowflake's Snowsight UI, select Create Worksheet from the SQL file +From the sidebar on the left, navigate to the Projects > Worksheets +Click the "..." in the top right corner and select "Create Worksheet from SQL File" from the drop-down menu +Run the entire worksheet to setup the tables required for the HOL. You can select all and hit "run" on the top right. Alternative, the keyboard shortcut is ctrl+enter (Windows) or command+return (Mac).