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

Kiran project1-june22 #35

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
8 changes: 8 additions & 0 deletions .idea/course-dbt.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions greenery/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

target/
dbt_packages/
logs/
15 changes: 15 additions & 0 deletions greenery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Welcome to your new dbt project!

### Using the starter project

Try running the following commands:
- dbt run
- dbt test


### Resources:
- Learn more about dbt [in the docs](https://docs.getdbt.com/docs/introduction)
- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers
- Join the [chat](https://community.getdbt.com/) on Slack for live discussions and support
- Find [dbt events](https://events.getdbt.com) near you
- Check out [the blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices
Empty file added greenery/analyses/.gitkeep
Empty file.
38 changes: 38 additions & 0 deletions greenery/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

# Name your project! Project names should contain only lowercase characters
# and underscores. A good package name should reflect your organization's
# name or the intended use of these models
name: 'greenery'
version: '1.0.0'
config-version: 2

# This setting configures which "profile" dbt uses for this project.
profile: 'greenery'

# These configurations specify where dbt should look for different types of files.
# The `model-paths` config, for example, states that models in this project can be
# found in the "models/" directory. You probably won't need to change these!
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

target-path: "target" # directory which will store compiled SQL files
clean-targets: # directories to be removed by `dbt clean`
- "target"
- "dbt_packages"


# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models

# In this example config, we tell dbt to build all models in the example/ directory
# as tables. These settings can be overridden in the individual model files
# using the `{{ config(...) }}` macro.
models:
greenery:
# Config indicated by + and applies to all files under models/example/
staging:
+materialized: view
Empty file added greenery/macros/.gitkeep
Empty file.
111 changes: 111 additions & 0 deletions greenery/models/staging/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
version: 2

models:
- name: stg_orders__orders
description: A staging model for oders data.
columns:
- name: order_id
description: Unique identifier for an order.
tests:
- unique
- name: user_id
- name: promo_id
- name: address_id
- name: created_at
- name: order_cost
- name: order_total
- name: tracking_id
- name: shipping_service
- name: estimated_delivery_at
- name: delivered_at
- name: status
- name: stg_addresses__addresses
description: A staging model for addresses data.
columns:
- name: addresses_id
description: Unique identifier for an address.
tests:
- unique
- name: address
- name: zipcode
- name: state
- name: country
- name: stg_events__events
description: A staging model for addresses data.
columns:
- name: event_id
description: Unique identifier for an event.
tests:
- unique
- name: session_id
- name: user_id
- name: page_url
- name: created_at
- name: event_type
- name: order_id
- name: product_id
- name: stg_order_items__order_items
description: A staging model for order items data.
columns:
- name: order_id
description: Unique identifier for an event.
tests:
- unique
- name: product_id
- name: qunantity
- name: stg_products__products
description: A staging model for products data.
columns:
- name: product_id
description: Unique identifier for product.
tests:
- unique
- name: product_id
- name: name
- name: price
- name: inventory
- name: stg_promos__promos
description: A staging model for promos data.
columns:
- name: promo_id
description: Unique identifier for promos.
tests:
- unique
- name: discount
- name: status
- name: stg_superheroes__superheroes
description: A staging model for superheroes data.
columns:
- name: id
description: Unique identifier for superheroes.
tests:
- unique
- name: name
- name: gender
- name: eye_color
- name: hair_color
- name: height
- name: publisher
- name: skin_color
- name: alignment
- name: weight
- name: created_at
- name: updated_at
- name: stg_users__users
description: A staging model for users data.
columns:
- name: user_id
description: Unique identifier for users.
tests:
- unique
- name: first_name
- name: last_name
- name: email
- name: phone_number
- name: created_at
- name: updated_at
- name: address_id




43 changes: 43 additions & 0 deletions greenery/models/staging/source.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 2

sources:
- name: src_orders
database: dbt
schema: public
tables:
- name: orders
- name: src_addresses
database: dbt
schema: public
tables:
- name: addresses
- name: src_events
database: dbt
schema: public
tables:
- name: events
- name: src_order_items
database: dbt
schema: public
tables:
- name: order_items
- name: src_products
database: dbt
schema: public
tables:
- name: products
- name: src_promos
database: dbt
schema: public
tables:
- name: promos
- name: src_superheroes
database: dbt
schema: public
tables:
- name: superheroes
- name: src_users
database: dbt
schema: public
tables:
- name: users
15 changes: 15 additions & 0 deletions greenery/models/staging/stg_addresses__addresses.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
with addresses as (
select * from {{ source('src_addresses', 'addresses')}}
),

final as (
select
address_id,
address,
zipcode,
state,
country
from addresses
)

select * from final
18 changes: 18 additions & 0 deletions greenery/models/staging/stg_events__events.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
with events as (
select * from {{ source('src_events', 'events') }}
),

final as (
select
event_id
,session_id
,user_id
,page_url
,created_at as created_at_utc
,event_type
,order_id
,product_id
from events
)

select * from events
13 changes: 13 additions & 0 deletions greenery/models/staging/stg_order_items__order_items.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
with order_items as (
select * from {{ source('src_order_items', 'order_items')}}
),

final as (
select
order_id
,product_id
,quantity
from order_items
)

select * from final
24 changes: 24 additions & 0 deletions greenery/models/staging/stg_orders__orders.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
with orders as (
select * from {{ source('src_orders', 'orders')}}
),

final as (
select
order_id,
user_id,
promo_id,
address_id,
created_at as created_at_utc,
order_cost,
order_total,
tracking_id,
shipping_service,
estimated_delivery_at as estimated_delivery_at_utc,
delivered_at as delivered_at_utc,
status
from
orders
)

select * from final

Loading