Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hightouch Solutions Center Source Code #118

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions samples/hightouch_quickstart_data/README.md
Original file line number Diff line number Diff line change
@@ -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).
51 changes: 51 additions & 0 deletions samples/hightouch_quickstart_data/setup_sample_data.sql
Original file line number Diff line number Diff line change
@@ -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;