Skip to main content
Version: v1.16

DATAVAULT4DBT SNIPPETS


To make it easier for you to use Datavault4dbt while using Visual Studio Code as your IDE, we created an extension with a collection of useful snippets to scaffold your data vault models as well as pre-populate hash keys and model names according to our naming conventions.

FEATURES

  • templates all datavault4dbt entities
  • supporting code blocks for repeated tasks like setting hash key and hashdiff
  • prepopulates hash keys from model name

HOW TO INSTALL

The simplest way to install the Datavault4dbt Snippets extension is directly from within the editor by navigating to the Extensions view. Once there, you can search for datavault4dbt Snippets and click the Install button on its page.

HOW TO USE

Datavault4dbt snippets are prefixed with two underscores. Codeblocks created by these have several prepopulated fields that you can go through by tabbing through them. When creating a Stage, you can use the __stg snippet to create the skeleton for the stage macro that you can then tab through to fill out all steps necessary to build your model. Create a new hashkey by using the __hk block, add a multi-active satellite by using __ma_config, and many more.

SNIPPETS

CategoryTypePrefix
Datavault4dbt entities
Stage__stg, __stg_dv
HubStandard__hub, __h
LinkStandard__link, __l
LinkNon-historized__nh_link, __nhl, __nl
SatelliteStandard v0__sat_v0, __v0
SatelliteStandard v1__sat_v1, __v1
SatelliteNon-historized__nh_sat
SatelliteRecord-Tracking__rts
SatelliteEffectivity__es, __effsat, __eff_sat
SatelliteMulti-Active v0__msat_v0, __ms_v0
SatelliteMulti-Active v1__msat_v1, __ms_v1
ReferenceHub__ref_hub, __rh
ReferenceSatellite v0__ref_sat_v0, __rs_v0
ReferenceSatellite v1__ref_sat_v1, __rs_v1
ReferenceTable__ref_table, __r
PIT Table__PIT, __pit
Snapshot Controlv0__snap_ctrl_v0, __sc_v0
Snapshot Controlv1__snap_ctrl_v1, __sc_v1
Supporting Snippets
StageHash Key__hk, __hashkey
StageHash Diff__hd, __hashdiff
StagePrejoined Column__prejoin
StageDerived Column__stg_derived_column
StageMissing Column__stg_missing_column
StageMulti-active Config__ma_config, __multi_active_config
Raw VaultSource Model__src_model, __source_model
Business VaultSnapshot Control Desired Duration__log_logic, __logarithmic_logic

Enjoy!