Overriding
I can do better, let's override !
resource-path is crucial to override a resource. Please check the docs if the concept is new to you.What is overriding ?
The core.dashboards_store only provides a reasonable default implementation. Maybe, you want 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_storea file namedoverride_me_plz.sql- You probably should mirror the folder structure of the file you are overriding.
- Tell dbt not to use the core implementation of
override_me_plz.sqlby adding the following snippet in yourdbt_project.ymlfile :
#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.Example
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.sqlincssXX.dashboards_store/models/marts/human_resources/features/retirement/fact_retirement.sqlpopulated with my own custom implementation. - I then add the following snippet in my
dbt_project.ymlfile :
#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.
Enabling a resource
By default, the Store does not materialize anything. You need to enable the models you want to materialize. We do this to avoid materializing data you do not need: if you are interested in only one dashboard, then you do not need to materialize the whole core_dashboards_store.
Introduction
