Skip to content

Instantly share code, notes, and snippets.

@ljhopkins2
ljhopkins2 / dbt_redshift_drop_vestigial_relations.sql
Last active March 22, 2024 03:41
Looks for db entities that are not in the `dbt` project and produces (and optionally runs) SQL to drop them
{%- macro drop_vestigial_relations(
exclude_schemas=[],
dry_run=False,
raise_on_dry_run=False
) %}
{%- if exclude_schemas is string %}
{%- set exclude_schemas = [exclude_schemas] %}
{%- elif exclude_schemas is not iterable %}
{%- do exceptions.raise_compiler_error('`exclude_schemas` must be a string or a list') %}
{%- endif %}
@clhenrick
clhenrick / README.md
Last active April 1, 2024 14:55
PostgreSQL & PostGIS cheatsheet (a work in progress)