Datavault-UK / automate-dv-demo

An example dbt project using AutomateDV to create a Data Vault 2.0 Data Warehouse based on the Snowflake TPC-H dataset.
https://www.automate-dv.com
Apache License 2.0
37 stars 35 forks source link

Some missing links key mappings #3

Open belaidcherfa opened 3 years ago

belaidcherfa commented 3 years ago

Hello folks,

First of all, thank you for your work. I use dbt_vault and the regularly published examples on projects and you can't imagine how it simplifies my daily work :)

This morning, I wanted to transcribe the metadata into an Excel file in order to centralize and regenerate the models. I noticed a little oversight or maybe it's wanted!

In the LNK_INVENTORY_ALLOCATION Link.

The primary key of the link is 'INVENTORY_ALLOCATION_PK' and the foreign keys are "PART_PK", "SUPPLIER_PK", "LINEITEM_PK"

In the "v_stg_orders" staging view, you have defined the key with three source columns :

INVENTORY_ALLOCATION_PK:
  - 'LINENUMBER'
  - 'PARTKEY'
  - 'SUPPLIERKEY'

While,

PART_PK: 'PARTKEY'
SUPPLIER_PK: 'SUPPLIERKEY'
LINEITEM_PK:
  -  'ORDERKEY'
  -  'LINENUMBER'

I think ORDERKEY is missing in the hash calculation of the primary key of the link

I thank you a lot.

DVAlexHiggs commented 3 years ago

Thank you for your feedback, we're glad you're finding the package useful!

As for the mapping, I think this is correct, as the ORDERKEY is not part of the relationship. This relationship between ORDER and LINEITEM is modelled in the LINK_ORDER_LINEITEM.

I will double check this, however.

dangdembey2023github commented 1 year ago

As a newbie trying to explore this, and much Appreciate sharing your thoughts and experience if any of you ever encountered the error below from 'dbtvault-snowflakeDemo'.


Compilation Error Model 'model.dbtvault_snowflake_demo.raw_transactions' (models/raw_stage/raw_transactions.sql) depends on a source named 'tpch_sample.ORDERS' which was not found

image