Skip to content
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
2 changes: 1 addition & 1 deletion tasty_bytes_dbt_demo/models/staging/__sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
sources:
- name: tb_101
description: 'Point of Sale source data'
database: tasty_bytes_dbt_db
database: test_dbt_integration
schema: RAW
tables:
- name: COUNTRY
Expand Down
4 changes: 4 additions & 0 deletions tasty_bytes_dbt_demo/package-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages:
- package: dbt-labs/dbt_utils
version: 1.3.0
sha1_hash: 226ae69cdfbc9367e2aa2c472b01f99dbce11de0
8 changes: 4 additions & 4 deletions tasty_bytes_dbt_demo/profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ tasty_bytes:
account: 'not needed'
user: 'not needed'
role: accountadmin
database: tasty_bytes_dbt_db
database: TEST_DBT_INTEGRATION
schema: dev
warehouse: tasty_bytes_dbt_wh
warehouse: dbt_wh
prod:
type: snowflake
account: 'not needed'
user: 'not needed'
role: accountadmin
database: tasty_bytes_dbt_db
database: TEST_DBT_INTEGRATION
schema: prod
warehouse: tasty_bytes_dbt_wh
warehouse: dbt_wh
114 changes: 57 additions & 57 deletions tasty_bytes_dbt_demo/setup/tasty_bytes_setup.sql
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
USE ROLE accountadmin;

CREATE OR REPLACE WAREHOUSE tasty_bytes_dbt_wh
WAREHOUSE_SIZE = 'small'
WAREHOUSE_TYPE = 'standard'
AUTO_SUSPEND = 60
AUTO_RESUME = TRUE
INITIALLY_SUSPENDED = TRUE
COMMENT = 'warehouse for tasty bytes dbt demo';
-- CREATE OR REPLACE WAREHOUSE tasty_bytes_dbt_wh
-- WAREHOUSE_SIZE = 'small'
-- WAREHOUSE_TYPE = 'standard'
-- AUTO_SUSPEND = 60
-- AUTO_RESUME = TRUE
-- INITIALLY_SUSPENDED = TRUE
-- COMMENT = 'warehouse for tasty bytes dbt demo';

USE WAREHOUSE tasty_bytes_dbt_wh;
USE WAREHOUSE dbt_wh;

CREATE DATABASE IF NOT EXISTS tasty_bytes_dbt_db;
CREATE OR REPLACE SCHEMA tasty_bytes_dbt_db.raw;
CREATE OR REPLACE SCHEMA tasty_bytes_dbt_db.dev;
CREATE OR REPLACE SCHEMA tasty_bytes_dbt_db.prod;
CREATE DATABASE IF NOT EXISTS test_dbt_integration;
CREATE OR REPLACE SCHEMA test_dbt_integration.raw;
CREATE OR REPLACE SCHEMA test_dbt_integration.dev;
CREATE OR REPLACE SCHEMA test_dbt_integration.prod;


ALTER SCHEMA tasty_bytes_dbt_db.dev SET LOG_LEVEL = 'INFO';
ALTER SCHEMA tasty_bytes_dbt_db.dev SET TRACE_LEVEL = 'ALWAYS';
ALTER SCHEMA tasty_bytes_dbt_db.dev SET METRIC_LEVEL = 'ALL';
ALTER SCHEMA test_dbt_integration.dev SET LOG_LEVEL = 'INFO';
ALTER SCHEMA test_dbt_integration.dev SET TRACE_LEVEL = 'ALWAYS';
ALTER SCHEMA test_dbt_integration.dev SET METRIC_LEVEL = 'ALL';

ALTER SCHEMA tasty_bytes_dbt_db.prod SET LOG_LEVEL = 'INFO';
ALTER SCHEMA tasty_bytes_dbt_db.prod SET TRACE_LEVEL = 'ALWAYS';
ALTER SCHEMA tasty_bytes_dbt_db.prod SET METRIC_LEVEL = 'ALL';
ALTER SCHEMA test_dbt_integration.prod SET LOG_LEVEL = 'INFO';
ALTER SCHEMA test_dbt_integration.prod SET TRACE_LEVEL = 'ALWAYS';
ALTER SCHEMA test_dbt_integration.prod SET METRIC_LEVEL = 'ALL';

CREATE OR REPLACE API INTEGRATION git_integration
API_PROVIDER = git_https_api
API_ALLOWED_PREFIXES = ('https://github.com/')
ENABLED = TRUE;
-- CREATE OR REPLACE API INTEGRATION git_integration
-- API_PROVIDER = git_https_api
-- API_ALLOWED_PREFIXES = ('https://github.com/')
-- ENABLED = TRUE;

CREATE OR REPLACE NETWORK RULE tasty_bytes_dbt_db.public.dbt_network_rule
MODE = EGRESS
TYPE = HOST_PORT
VALUE_LIST = ('hub.getdbt.com', 'codeload.github.com');
-- CREATE OR REPLACE NETWORK RULE test_dbt_integration.public.dbt_network_rule
-- MODE = EGRESS
-- TYPE = HOST_PORT
-- VALUE_LIST = ('hub.getdbt.com', 'codeload.github.com');

CREATE OR REPLACE EXTERNAL ACCESS INTEGRATION dbt_access_integration
ALLOWED_NETWORK_RULES = (tasty_bytes_dbt_db.public.dbt_network_rule)
ENABLED = true;
-- CREATE OR REPLACE EXTERNAL ACCESS INTEGRATION dbt_access_integration
-- ALLOWED_NETWORK_RULES = (test_dbt_integration.public.dbt_network_rule)
-- ENABLED = true;

CREATE OR REPLACE FILE FORMAT tasty_bytes_dbt_db.public.csv_ff
CREATE OR REPLACE FILE FORMAT test_dbt_integration.public.csv_ff
type = 'csv';

CREATE OR REPLACE STAGE tasty_bytes_dbt_db.public.s3load
CREATE OR REPLACE STAGE test_dbt_integration.public.s3load
COMMENT = 'Quickstarts S3 Stage Connection'
url = 's3://sfquickstarts/frostbyte_tastybytes/'
file_format = tasty_bytes_dbt_db.public.csv_ff;
file_format = test_dbt_integration.public.csv_ff;

/*--
raw zone table build
--*/

-- country table build
CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.country
CREATE OR REPLACE TABLE test_dbt_integration.raw.country
(
country_id NUMBER(18,0),
country VARCHAR(16777216),
Expand All @@ -64,7 +64,7 @@ CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.country
COMMENT = '{"origin":"sf_sit-is", "name":"tasty-bytes-dbt", "version":{"major":1, "minor":0}, "attributes":{"is_quickstart":1, "source":"sql"}}';

-- franchise table build
CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.franchise
CREATE OR REPLACE TABLE test_dbt_integration.raw.franchise
(
franchise_id NUMBER(38,0),
first_name VARCHAR(16777216),
Expand All @@ -77,7 +77,7 @@ CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.franchise
COMMENT = '{"origin":"sf_sit-is", "name":"tasty-bytes-dbt", "version":{"major":1, "minor":0}, "attributes":{"is_quickstart":1, "source":"sql"}}';

-- location table build
CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.location
CREATE OR REPLACE TABLE test_dbt_integration.raw.location
(
location_id NUMBER(19,0),
placekey VARCHAR(16777216),
Expand All @@ -90,7 +90,7 @@ CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.location
COMMENT = '{"origin":"sf_sit-is", "name":"tasty-bytes-dbt", "version":{"major":1, "minor":0}, "attributes":{"is_quickstart":1, "source":"sql"}}';

-- menu table build
CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.menu
CREATE OR REPLACE TABLE test_dbt_integration.raw.menu
(
menu_id NUMBER(19,0),
menu_type_id NUMBER(38,0),
Expand All @@ -107,7 +107,7 @@ CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.menu
COMMENT = '{"origin":"sf_sit-is", "name":"tasty-bytes-dbt", "version":{"major":1, "minor":0}, "attributes":{"is_quickstart":1, "source":"sql"}}';

-- truck table build
CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.truck
CREATE OR REPLACE TABLE test_dbt_integration.raw.truck
(
truck_id NUMBER(38,0),
menu_type_id NUMBER(38,0),
Expand All @@ -127,7 +127,7 @@ CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.truck
COMMENT = '{"origin":"sf_sit-is", "name":"tasty-bytes-dbt", "version":{"major":1, "minor":0}, "attributes":{"is_quickstart":1, "source":"sql"}}';

-- order_header table build
CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.order_header
CREATE OR REPLACE TABLE test_dbt_integration.raw.order_header
(
order_id NUMBER(38,0),
truck_id NUMBER(38,0),
Expand All @@ -149,7 +149,7 @@ CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.order_header
COMMENT = '{"origin":"sf_sit-is", "name":"tasty-bytes-dbt", "version":{"major":1, "minor":0}, "attributes":{"is_quickstart":1, "source":"sql"}}';

-- order_detail table build
CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.order_detail
CREATE OR REPLACE TABLE test_dbt_integration.raw.order_detail
(
order_detail_id NUMBER(38,0),
order_id NUMBER(38,0),
Expand All @@ -164,7 +164,7 @@ CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.order_detail
COMMENT = '{"origin":"sf_sit-is", "name":"tasty-bytes-dbt", "version":{"major":1, "minor":0}, "attributes":{"is_quickstart":1, "source":"sql"}}';

-- customer loyalty table build
CREATE OR REPLACE TABLE tasty_bytes_dbt_db.raw.customer_loyalty
CREATE OR REPLACE TABLE test_dbt_integration.raw.customer_loyalty
(
customer_id NUMBER(38,0),
first_name VARCHAR(16777216),
Expand All @@ -189,36 +189,36 @@ COMMENT = '{"origin":"sf_sit-is", "name":"tasty-bytes-dbt", "version":{"major":1
--*/

-- country table load
COPY INTO tasty_bytes_dbt_db.raw.country
FROM @tasty_bytes_dbt_db.public.s3load/raw_pos/country/;
COPY INTO test_dbt_integration.raw.country
FROM @test_dbt_integration.public.s3load/raw_pos/country/;

-- franchise table load
COPY INTO tasty_bytes_dbt_db.raw.franchise
FROM @tasty_bytes_dbt_db.public.s3load/raw_pos/franchise/;
COPY INTO test_dbt_integration.raw.franchise
FROM @test_dbt_integration.public.s3load/raw_pos/franchise/;

-- location table load
COPY INTO tasty_bytes_dbt_db.raw.location
FROM @tasty_bytes_dbt_db.public.s3load/raw_pos/location/;
COPY INTO test_dbt_integration.raw.location
FROM @test_dbt_integration.public.s3load/raw_pos/location/;

-- menu table load
COPY INTO tasty_bytes_dbt_db.raw.menu
FROM @tasty_bytes_dbt_db.public.s3load/raw_pos/menu/;
COPY INTO test_dbt_integration.raw.menu
FROM @test_dbt_integration.public.s3load/raw_pos/menu/;

-- truck table load
COPY INTO tasty_bytes_dbt_db.raw.truck
FROM @tasty_bytes_dbt_db.public.s3load/raw_pos/truck/;
COPY INTO test_dbt_integration.raw.truck
FROM @test_dbt_integration.public.s3load/raw_pos/truck/;

-- customer_loyalty table load
COPY INTO tasty_bytes_dbt_db.raw.customer_loyalty
FROM @tasty_bytes_dbt_db.public.s3load/raw_customer/customer_loyalty/;
COPY INTO test_dbt_integration.raw.customer_loyalty
FROM @test_dbt_integration.public.s3load/raw_customer/customer_loyalty/;

-- order_header table load
COPY INTO tasty_bytes_dbt_db.raw.order_header
FROM @tasty_bytes_dbt_db.public.s3load/raw_pos/order_header/;
COPY INTO test_dbt_integration.raw.order_header
FROM @test_dbt_integration.public.s3load/raw_pos/order_header/;

-- order_detail table load
COPY INTO tasty_bytes_dbt_db.raw.order_detail
FROM @tasty_bytes_dbt_db.public.s3load/raw_pos/order_detail/;
COPY INTO test_dbt_integration.raw.order_detail
FROM @test_dbt_integration.public.s3load/raw_pos/order_detail/;

-- setup completion note
SELECT 'tasty_bytes_dbt_db setup is now complete' AS note;
SELECT 'test_dbt_integration setup is now complete' AS note;