Extending
Extending dbtvault¶
This page describes how write your own macros to replace existing macros provided in dbtvault.
adapter.dispatch¶
Every macro in dbtvault first calls adapter.dispatch to find platform specific implementations of the macro to execute.
Here is an example:
1 2 3 4 5 6 7 |
|
This snippet defines the macro namespace as 'dbtvault'
, ensuring that this macro gets found in the list of macros implemented in the dbtvault package namespace.
To override the hub
macro and ensure dbt uses your own implementation of it, you simply need to provide a configuration in your dbt_project.yml
as follows:
1 2 3 4 5 6 7 8 |
|
With this configuration change, an implementation of the hub
macro could be defined in your own project as follows:
1 2 3 4 5 |
|
Here are some further examples, showing how to override a platform-specific implementation:
1 2 3 4 5 |
|
1 2 3 4 5 |
|
1 2 3 4 5 |
|
...and that's it! Yay!
Further reading
Please ensure you read the dbt adapter.dispatch and dispatch config docs for more details.