Skip to content

PostgreSQL-specific utility macros for dbt projects.

License

Notifications You must be signed in to change notification settings

sgoley/dbt-postgres-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Postgres Utils

This dbt package contains Postgres-specific macros that can be (re)used across dbt projects.

Project Plan

Available in detail on Trello dbt-postgres-utils - voting enabled!

Installation Instructions

Check dbt Hub for the latest installation instructions, or read the docs for more information on installing packages.

Prerequisites

Postgres Utils is compatible with dbt 0.17.0 and later.


Optimizers

index (source)

This macro creates an index on a given column.

PostgreSQL Docs: Index

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).

PostgreSQL Docs: Unique Index

Usage (at end of model definition .sql file):

{{
config({
    "post-hook": [
      "{{ postgres_utils.uindex(this, 'id')}}",
    ],
    })
}}

Acknowlegements

This project extends fishtown-analytics's own postgres project available here:

https://github.com/fishtown-analytics/postgres (source of index macro)