#!/bin/bash -e

# This script seeds metadata tables and runs the views.
# It accepts dbt run options like --target, --full-refresh, --models
# and --vars.

# Remove stale partial parse cache to avoid compilation errors when
# env vars like SOURCE_SNOWFLAKE_SCHEMA change between runs (dbt 1.9
# does not detect env var changes in YAML source name fields).
rm -f target/partial_parse.msgpack

# Run views
echo 'dbt run '"$@"
pipenv run dbt run "$@"
