Load Data

The data for this project is stored in CSV format within a publicly accessible S3 bucket. Follow these steps to add it to your Snowflake account for data ingestion.

To run these scripts create a worksheet and add these commands in that worksheet and click run

  1. This script is creating a new warehouse, creating two empty databases and two empty schemas within those databases.

create warehouse transforming;
create database raw;
create database analytics;
create schema raw.jaffle_shop;
create schema raw.stripe;
  1. Create a new table customers

create table raw.jaffle_shop.customers 
( id integer,
  first_name varchar,
  last_name varchar
);
  1. Add data to that table

copy into raw.jaffle_shop.customers (id, first_name, last_name)
from 's3://dbt-tutorial-public/jaffle_shop_customers.csv'
file_format = (
    type = 'CSV'
    field_delimiter = ','
    skip_header = 1
    ); 
  1. Create a new table orders

create table raw.jaffle_shop.orders
( id integer,
  user_id integer,
  order_date date,
  status varchar,
  _etl_loaded_at timestamp default current_timestamp
);
  1. Add data to that table

copy into raw.jaffle_shop.orders (id, user_id, order_date, status)
from 's3://dbt-tutorial-public/jaffle_shop_orders.csv'
file_format = (
    type = 'CSV'
    field_delimiter = ','
    skip_header = 1
    );
  1. Create a new table payment

create table raw.stripe.payment 
( id integer,
  orderid integer,
  paymentmethod varchar,
  status varchar,
  amount integer,
  created date,
  _batched_at timestamp default current_timestamp
);// Some code
  1. Add data to that table

copy into raw.stripe.payment (id, orderid, paymentmethod, status, amount, created)
from 's3://dbt-tutorial-public/stripe_payments.csv'
file_format = (
    type = 'CSV'
    field_delimiter = ','
    skip_header = 1
    );
  1. Run these commands and check the results section to ensure that the data has been ingested.

select * from raw.jaffle_shop.customers;
select * from raw.jaffle_shop.orders;
select * from raw.stripe.payment;   

Last updated