I can do better, let's override !
resrouce-path
is crucial to override a resource. Please check the doc if the concept is new to you.What is overriding ?
The core.dashboards_store
only provides a reasonable default implementation. Maybe, you wan't to add a KPI to a dashboard, or change part of an SQL script. You can do so by overriding the default implementation. Everything is overridable. So don't be shy and make the Store your own.
Where does overriding happen ?
Overriding always happens in your cssXX.dashboards_store
project. Do not manually edit the core.dashboards_store
project as doing so will make version bumping a hellish nightmare.
How to override.
To override a script named override_me_plz.sql
, you need to :
- Create, in
cssXX.dashboards_store
a file namedoverride_me_plz.sql
- You probably schould mirror the folder structure of the file you are overriding.
- Tell dbt not to use the core implementation of
override_me_plz.sql
by adding the following snippet in yourdbt_project.yml
file :
#cssXX.dashboards_store/dbt_project.yml
<models|seeds|tests>: # Choose the resource's key you want to override
core_dashboards_store:
<path_to_resource>: # The path to the resource you want to override, one key per part
override_me_plz:
+enabled: False
<models|seeds|tests>
: use models
when overriding a model, seeds
when overriding a seed, and tests
when disabling or overriding a test.Exemple
Overriding a SQL script
Let's say that I want to override the file defined in core.dashboards_store/models/marts/human_resources/features/retirement/fact_retirement.sql
:
- I first create a file named
fact_retirement.sql
incssXX.dashboards_store/models/marts/human_resources/features/retirement/fact_retirement.sql
populated with my own custom implementation. - I then add the following snippet in my
dbt_project.yml
file :
#cssXX.dashboards_store/dbt_project.yml
models:
core_dashboards_store:
marts:
human_resources:
features:
retirement:
fact_retirement:
+enabled: False
When running DBT, my own definition will be used as a drop-in replacement for the core implementation.