Dina Kleper
Dina Kleper

Reputation: 2061

Where to find dbt macros when wishing to edit it

I'm trying to implement a "merge_exclude_columns" configuration in my dbt project as suggested here:

https://github.com/dbt-labs/dbt-core/pull/3100#issuecomment-904502858

My question is kind of basic - I assume I need to add this macro to the exsiting merge.sql macro but now sure where I'm suppose to find it.

Thank you.

Upvotes: 3

Views: 2854

Answers (2)

Toàn Đoàn
Toàn Đoàn

Reputation: 487

For those of you looking for this information like me, the git repo has been changed to this folder. Global macro is no longer contained in dbt-core repo now, but has been split into a separate repo named dbt-adapters

Upvotes: 3

Adeeb Armalite
Adeeb Armalite

Reputation: 704

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.

Upvotes: 5

Related Questions