Skip to content

Commit

Permalink
Add Flow to the example DWH
Browse files Browse the repository at this point in the history
  • Loading branch information
marchinho11 committed Apr 10, 2023
1 parent 87d072d commit 7a1c9d3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

* [Basic hNhM concepts](#basic-hnhm-concepts)
* [Quick Start](#quick-start)
* [DWH example](#dwh-example)
* [Guide](#guide)

### Basic hNhM concepts
Expand Down Expand Up @@ -93,4 +94,7 @@ The physical result of applied changes:

<img src="assets/quick_start_result.png" height="150px">

## DWH example
Full DWH example including Entities, Links and Flows can be found in the [`dwh/`](dwh/) directory.

## Guide
30 changes: 30 additions & 0 deletions dwh/flows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from hnhm import Flow

from .user import User
from .review import Review
from .amazon_stage import AmazonStg
from .user_review import LinkUserReview

flow = (
Flow(source=AmazonStg(), business_time_field=AmazonStg.time)
.load(
User(),
mapping={
User.user_id: AmazonStg.user_id,
User.name: AmazonStg.name,
},
)
.load(
Review(),
mapping={
Review.review_id: AmazonStg.review_id,
Review.user_id: AmazonStg.user_id,
Review.text: AmazonStg.text,
Review.rating: AmazonStg.rating,
},
)
.load(LinkUserReview())
)

if __name__ == "__main__":
print(flow.tasks)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hnhm"
version = "0.0.3"
version = "0.0.4"
description = "hNhM – highly Normalized hybrid Model."
authors = ["Arseny Egorov <[email protected]>"]

Expand Down

0 comments on commit 7a1c9d3

Please sign in to comment.