From 21ae47a5690479ec15e8d6358f74390e54b2f5d8 Mon Sep 17 00:00:00 2001 From: Jillian Vogel Date: Thu, 20 Jun 2024 16:33:34 +0930 Subject: [PATCH 1/2] fix: install dbt requirements only if file is present `dbt init` does not create a requirements.txt file by default, and so dbt extensions may not have this file. --- .../templates/aspects/apps/aspects/scripts/dbt.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh b/tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh index fa3548f0e..823f2947e 100644 --- a/tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh +++ b/tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh @@ -23,8 +23,13 @@ git clone -b {{ DBT_BRANCH }} {{ DBT_REPOSITORY }} aspects-dbt cd aspects-dbt -echo "Installing dbt python requirements" -pip install -r ./requirements.txt +if [ -e "./requirements.txt" ] +then + echo "Installing dbt python requirements" + pip install -r ./requirements.txt +else + echo "No requirements.txt file found; skipping" +fi export ASPECTS_EVENT_SINK_DATABASE={{ASPECTS_EVENT_SINK_DATABASE}} export ASPECTS_XAPI_DATABASE={{ASPECTS_XAPI_DATABASE}} From 7fc8c4e80a02d8e802384f6f68e6d04c0a98d315 Mon Sep 17 00:00:00 2001 From: Jillian Vogel Date: Thu, 20 Jun 2024 16:34:13 +0930 Subject: [PATCH 2/2] fix: pass DBT_PROFILE_TARGET_DATABASE into the env before running dbt This variable is referenced in various aspects-dbt models. --- tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh b/tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh index 823f2947e..6908681d9 100644 --- a/tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh +++ b/tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh @@ -35,6 +35,7 @@ export ASPECTS_EVENT_SINK_DATABASE={{ASPECTS_EVENT_SINK_DATABASE}} export ASPECTS_XAPI_DATABASE={{ASPECTS_XAPI_DATABASE}} export DBT_STATE={{ DBT_STATE_DIR }} export ASPECTS_DATA_TTL_EXPRESSION="{{ ASPECTS_DATA_TTL_EXPRESSION }}" +export DBT_PROFILE_TARGET_DATABASE="{{ DBT_PROFILE_TARGET_DATABASE }}" echo "Installing dbt dependencies" dbt deps --profiles-dir /app/aspects/dbt/