This dbt package contains Postgres-specific macros that can be (re)used across dbt projects.
Available in detail on Trello dbt-postgres-utils - voting enabled!
Check dbt Hub for the latest installation instructions, or read the docs for more information on installing packages.
Postgres Utils is compatible with dbt 0.17.0 and later.
index (source)
This macro creates an index on a given column.
Usage (at end of model definition .sql file):
{{
config({
"post-hook": [
"{{ postgres_utils.index(this, 'id')}}",
],
})
}}
uindex (source)
This macro creates an index on a given column which contains unique values (required to be fully distinct).
Usage (at end of model definition .sql file):
{{
config({
"post-hook": [
"{{ postgres_utils.uindex(this, 'id')}}",
],
})
}}
This project extends fishtown-analytics's own postgres project available here:
https://github.com/fishtown-analytics/postgres (source of index macro)