Skip to content

Commit

Permalink
Tweaks to better support extending aspects-dbt (#877)
Browse files Browse the repository at this point in the history
* 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.

* fix: pass DBT_PROFILE_TARGET_DATABASE into the env before running dbt

This variable is referenced in various aspects-dbt models.
  • Loading branch information
pomegranited authored Jun 20, 2024
1 parent c71f583 commit e3618b8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@ 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}}
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/
Expand Down

0 comments on commit e3618b8

Please sign in to comment.