Building the REF layer with the dimensional data
Let’s continue building the security info dimension by building the REF model for it.
Let’s do it:
- Create a new file named
REF_ABC_BANK_SECURITY_INFO.sql
in themodels/refined
folder. - Enter the following code in the file:
WITH
current_from_snapshot as (
SELECT *
FROM {{ ref('SNSH_ABC_BANK_SECURITY_INFO') }}
WHERE DBT_VALID_TO is null
)
SELECT *
FROM current_from_snapshot
You can see that the content of this file is pretty much the same as the REF model we created earlier for the REF model of the position fact.
We have created our REF model, so build it with the following code:
dbt build -s REF_ABC_BANK_SECURITY_INFO
Looking at the columns in the model, we can see that there are the DBT_SCD_ID
, DBT_UPDATED_AT
, DBT_VALID_FROM
, and DBT_VALID_TO
technical columns, which are not so useful outside of the snapshot.
We can...