-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbt_project_setup.sh
33 lines (26 loc) · 1005 Bytes
/
dbt_project_setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# set working directory to top level of repo
cd $(git rev-parse --show-toplevel)
# set up virtual environment and activate it
if [ -d "venv" ]
then
source venv/bin/activate
pip install --upgrade pip
else
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
fi
# Install Python libraries (user)
pip install -r requirements.txt
# default dbt to look in current directory whenever the dbt command is used
# note, it will be relative to whatever the working directory is (we're going to change it in next step)
export DBT_PROFILES_DIR=.
# Add venv* to .gitignore file - if 'venv*' not in .gitignore, appends it
# (-q: be quiet, -x: match the whole line, -F: pattern is a plain string)
# taken from: https://stackoverflow.com/questions/3557037/appending-a-line-to-a-file-only-if-it-does-not-already-exist
grep -qxF 'venv*' .gitignore || echo 'venv*' >> .gitignore
# change working directory to dbt project
cd dbt_bigquery_info_schema
# test
dbt debug