Where to find dbt macros when wishing to edit it

Viewed 22
1 Answers

If it helps, the global dbt macros are located in the following path in the dbt-core repository. If you are specifically looking for the merge.sql implementation, it can be found here.

You can override global dbt macros by creating a macro in your local project using the same name, therefore allowing re-implementation of the global macro. If you are wanting to implement additional logic in merge.sql I would suggest overriding it, include all existing code plus add anything additional to achieve your merge_exclude_columns configuration.

An example where this is often done is the generate_schema_name macro, which handles how schema name concatenation behaves between project level and model level schema settings. By creating a macro named generate_schema_name in my own project I can override the global macro and define how I want schema concatenation to work in my own project.

Related