You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.md
+1
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,7 @@ If you were relying on the position to match up your optional arguments, this ma
50
50
51
51
## Fixes
52
52
* Handle booleans gracefully in the unpivot macro ([#305](https://github.com/fishtown-analytics/dbt-utils/pull/305)[@avishalom](https://github.com/avishalom))
53
+
* Fix a bug in `get_relation_by_prefix` that happens with Snowflake external tables. Now the macro will retrieve tables that match the prefix which are external tables ([#350](https://github.com/fishtown-analytics/dbt-utils/issues/350))
Copy file name to clipboardexpand all lines: README.md
+8-5
Original file line number
Diff line number
Diff line change
@@ -1088,9 +1088,10 @@ We welcome contributions to this repo! To contribute a new feature or a fix, ple
1088
1088
1089
1089
### Dispatch macros
1090
1090
1091
-
**Note:** This is primarily relevant to users and maintainers of community-supported
1092
-
database plugins. If you use Postgres, Redshift, Snowflake, or Bigquery, this likely
1093
-
does not apply to you.
1091
+
**Note:** This is primarily relevant to:
1092
+
- Users and maintainers of community-supported [adapter plugins](https://docs.getdbt.com/docs/available-adapters)
1093
+
- Users who wish to override a low-lying `dbt_utils` macro with a custom implementation, and have that implementation used by other `dbt_utils` macros
1094
+
If you use Postgres, Redshift, Snowflake, or Bigquery, this likely does not apply to you.
1094
1095
1095
1096
dbt v0.18.0 introduces `adapter.dispatch()`, a reliable way to define different implementations of the same macro
1096
1097
across different databases.
@@ -1101,15 +1102,17 @@ variable in your project, when dbt searches for implementations of a dispatched
1101
1102
`dbt_utils`macro, it will search through your listed packages _before_ using
1102
1103
the implementations defined in `dbt_utils`.
1103
1104
1104
-
Set the variable:
1105
+
Set a variable in your `dbt_project.yml`:
1105
1106
```yml
1106
1107
vars:
1107
1108
dbt_utils_dispatch_list:
1108
-
- first_package_to_search # likely the name of your root project
1109
+
- first_package_to_search # likely the name of your root project (only the root folder)
1109
1110
- second_package_to_search # likely an "add-on" package, such as spark_utils
1110
1111
# dbt_utils is always the last place searched
1111
1112
```
1112
1113
1114
+
If overriding a dispatched macro with a custom implementation in your own project's `macros/` directory, you must name your custom macro with a prefix: either `default__` (note the two underscores), or the name of your adapter followed by two underscores. For example, if you're running on Postgres and wish to override the behavior of `dbt_utils.datediff` (such that `dbt_utils.date_spine` will use your version instead), you can do this by defining a macro called either `default__datediff` or `postgres__datediff`.
1115
+
1113
1116
When running on Spark, if dbt needs to dispatch `dbt_utils.datediff`, it will search for the following in order:
0 commit comments