Skip to content

Commit b85d346

Browse files
committed
test md link
1 parent 5b21c6e commit b85d346

File tree

2 files changed

+115
-1
lines changed

2 files changed

+115
-1
lines changed

dbt/dbt-udemy-course/readme.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
## 2024 DBT course - udemy
2-
course - https://github.com/nordquant/complete-dbt-bootcamp-zero-to-hero/blob/main/_course_resources/course-resources.md
2+
course - https://github.com/nordquant/complete-dbt-bootcamp-zero-to-hero/blob/main/_course_resources/course-resources.md
3+
instance -> https://supypql-om48075.snowflakecomputing.com/console/login
4+
5+
(Setup the course)[./setup.md]

dbt/dbt-udemy-course/setup.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
### Setup Snowflake Data
2+
3+
instance -> https://supypql-om48075.snowflakecomputing.com/console/login
4+
5+
6+
```sql
7+
-- Use an admin role
8+
USE ROLE ACCOUNTADMIN;
9+
10+
-- Create the `transform` role
11+
CREATE ROLE IF NOT EXISTS transform;
12+
GRANT ROLE TRANSFORM TO ROLE ACCOUNTADMIN;
13+
14+
-- Create the default warehouse if necessary
15+
CREATE WAREHOUSE IF NOT EXISTS COMPUTE_WH;
16+
GRANT OPERATE ON WAREHOUSE COMPUTE_WH TO ROLE TRANSFORM;
17+
18+
-- Create the `dbt` user and assign to role
19+
CREATE USER IF NOT EXISTS dbt
20+
PASSWORD='dbtPassword123'
21+
LOGIN_NAME='dbt'
22+
MUST_CHANGE_PASSWORD=FALSE
23+
DEFAULT_WAREHOUSE='COMPUTE_WH'
24+
DEFAULT_ROLE='transform'
25+
DEFAULT_NAMESPACE='AIRBNB.RAW'
26+
COMMENT='DBT user used for data transformation';
27+
GRANT ROLE transform to USER dbt;
28+
29+
-- Create our database and schemas
30+
CREATE DATABASE IF NOT EXISTS AIRBNB;
31+
CREATE SCHEMA IF NOT EXISTS AIRBNB.RAW;
32+
33+
-- Set up permissions to role `transform`
34+
GRANT ALL ON WAREHOUSE COMPUTE_WH TO ROLE transform;
35+
GRANT ALL ON DATABASE AIRBNB to ROLE transform;
36+
GRANT ALL ON ALL SCHEMAS IN DATABASE AIRBNB to ROLE transform;
37+
GRANT ALL ON FUTURE SCHEMAS IN DATABASE AIRBNB to ROLE transform;
38+
GRANT ALL ON ALL TABLES IN SCHEMA AIRBNB.RAW to ROLE transform;
39+
GRANT ALL ON FUTURE TABLES IN SCHEMA AIRBNB.RAW to ROLE transform;
40+
41+
-- Set up the defaults
42+
USE WAREHOUSE COMPUTE_WH;
43+
USE DATABASE airbnb;
44+
USE SCHEMA RAW;
45+
46+
-- Create our three tables and import the data from S3
47+
CREATE OR REPLACE TABLE raw_listings
48+
(id integer,
49+
listing_url string,
50+
name string,
51+
room_type string,
52+
minimum_nights integer,
53+
host_id integer,
54+
price string,
55+
created_at datetime,
56+
updated_at datetime);
57+
58+
COPY INTO raw_listings (id,
59+
listing_url,
60+
name,
61+
room_type,
62+
minimum_nights,
63+
host_id,
64+
price,
65+
created_at,
66+
updated_at)
67+
from 's3://dbtlearn/listings.csv'
68+
FILE_FORMAT = (type = 'CSV' skip_header = 1
69+
FIELD_OPTIONALLY_ENCLOSED_BY = '"');
70+
71+
72+
CREATE OR REPLACE TABLE raw_reviews
73+
(listing_id integer,
74+
date datetime,
75+
reviewer_name string,
76+
comments string,
77+
sentiment string);
78+
79+
COPY INTO raw_reviews (listing_id, date, reviewer_name, comments, sentiment)
80+
from 's3://dbtlearn/reviews.csv'
81+
FILE_FORMAT = (type = 'CSV' skip_header = 1
82+
FIELD_OPTIONALLY_ENCLOSED_BY = '"');
83+
84+
85+
CREATE OR REPLACE TABLE raw_hosts
86+
(id integer,
87+
name string,
88+
is_superhost string,
89+
created_at datetime,
90+
updated_at datetime);
91+
92+
COPY INTO raw_hosts (id, name, is_superhost, created_at, updated_at)
93+
from 's3://dbtlearn/hosts.csv'
94+
FILE_FORMAT = (type = 'CSV' skip_header = 1
95+
FIELD_OPTIONALLY_ENCLOSED_BY = '"');
96+
97+
```
98+
99+
## Setup local python
100+
Install python 3.11 and install virtualenv. **Create the folder for the course and install on it!**
101+
```python
102+
pip install virtualenv
103+
```
104+
create python venv
105+
```python
106+
virtual env --python=python3.11
107+
```
108+
activated venv (be in the folder)
109+
```python
110+
. venv/bin/activate
111+
```

0 commit comments

Comments
 (0)