-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from godatadriven/kg/dbt-logging-fix
Fix DBT examples
- Loading branch information
Showing
27 changed files
with
218 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
AIRFLOW_VERSION=2.6.3 | ||
AIRFLOW_VERSION=2.7.2 | ||
PYTHON_VERSION=3.9 | ||
AIRFLOW__API__AUTH_BACKEND=airflow.api.auth.backend.basic_auth | ||
MINIMAL_AIRFLOW_VERSION=2.2.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.pgdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
function empty_data_dir() { | ||
echo "================================" | ||
echo "== Cleanup local PG mount dir ==" | ||
echo "================================" | ||
local SCRIPT_DIR=$( dirname ${BASH_SOURCE[0]} ) | ||
PG_DATA_DIR="${SCRIPT_DIR}/../.pgdata" | ||
|
||
if [ "$(ls -A ${PG_DATA_DIR})" ]; then | ||
echo "${PG_DATA_DIR} is not empty. Clearing NOW!!" | ||
find ${PG_DATA_DIR} -mindepth 1 -delete | ||
else | ||
echo "${PG_DATA_DIR} is empty. Continue" | ||
fi | ||
} | ||
|
||
empty_data_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
#!/usr/bin/env bash | ||
sudo apt-get install -y libsasl2-dev build-essential | ||
pip install agate==1.6.1 airflow-dbt | ||
pip install dbt-core==1.4.5 airflow-dbt-python | ||
|
||
#airflow-dbt-python depends on the fs_default connection | ||
echo "=====================================" | ||
echo "== Configure FS Default connection ==" | ||
echo "=====================================" | ||
airflow connections add fs_default \ | ||
--conn-type fs \ | ||
--conn-extra "{\"path\": \"/\"}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
WHIRL_ENVIRONMENT=dbt-example | ||
MOCK_DATA_FOLDER=${DAG_FOLDER}/mock-data | ||
PYTHON_VERSION=3.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
function empty_log_dir() { | ||
echo "=====================================" | ||
echo "== Cleanup local DBT log mount dir ==" | ||
echo "=====================================" | ||
local SCRIPT_DIR=$( dirname ${BASH_SOURCE[0]} ) | ||
DBT_LOG_DIR="${SCRIPT_DIR}/../dbt/logs" | ||
|
||
if [ "$(ls -A ${DBT_LOG_DIR})" ]; then | ||
echo "${DBT_LOG_DIR} is not empty. Clearing NOW!!" | ||
find ${DBT_LOG_DIR} -mindepth 1 -not -name ".gitkeep" -delete | ||
else | ||
echo "${DBT_LOG_DIR} is empty. Continue" | ||
fi | ||
} | ||
|
||
empty_log_dir |
16 changes: 16 additions & 0 deletions
16
examples/dbt-example/compose.teardown.d/01_show_dbt_log.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
function show_logs() { | ||
echo "=======================" | ||
echo "== Show dbt run logs ==" | ||
echo "=======================" | ||
local SCRIPT_DIR=$( dirname ${BASH_SOURCE[0]} ) | ||
DBT_LOG_DIR="${SCRIPT_DIR}/../dbt/logs" | ||
|
||
if [ "$(ls -A ${DBT_LOG_DIR}/dbt.log)" ]; then | ||
echo "${DBT_LOG_DIR}/dbt.log exists. Showing log!!" | ||
sudo cat ${DBT_LOG_DIR}/dbt.log | ||
fi | ||
} | ||
|
||
show_logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.idea | ||
dbt_modules | ||
logs | ||
target | ||
.user.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
#!/usr/bin/env bash | ||
pip install dbt-postgres | ||
pip install dbt-postgres==1.4.5 | ||
|
||
sudo chmod -R ugo+rw /opt/airflow/dags/dbt-example/dbt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
WHIRL_ENVIRONMENT=s3-external-spark-hive | ||
MOCK_DATA_FOLDER=${DAG_FOLDER}/mock-data | ||
|
||
# DBT verbosity | ||
DBT_LOG_LEVEL=debug | ||
DBT_LOG_FORMAT=text | ||
DBT_LOG_FORMAT_FILE=text | ||
DBT_SEND_ANONYMOUS_USAGE_STATS=False |
18 changes: 18 additions & 0 deletions
18
examples/dbt-spark-example/compose.setup.d/02_clean_dbt_log.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
function empty_log_dir() { | ||
echo "=====================================" | ||
echo "== Cleanup local DBT log mount dir ==" | ||
echo "=====================================" | ||
local SCRIPT_DIR=$( dirname ${BASH_SOURCE[0]} ) | ||
DBT_LOG_DIR="${SCRIPT_DIR}/../dbt/logs" | ||
|
||
if [ "$(ls -A ${DBT_LOG_DIR})" ]; then | ||
echo "${DBT_LOG_DIR} is not empty. Clearing NOW!!" | ||
find ${DBT_LOG_DIR} -mindepth 1 -not -name ".gitkeep" -delete | ||
else | ||
echo "${DBT_LOG_DIR} is empty. Continue" | ||
fi | ||
} | ||
|
||
empty_log_dir |
16 changes: 16 additions & 0 deletions
16
examples/dbt-spark-example/compose.teardown.d/01_show_dbt_log.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
function show_logs() { | ||
echo "=======================" | ||
echo "== Show dbt run logs ==" | ||
echo "=======================" | ||
local SCRIPT_DIR=$( dirname ${BASH_SOURCE[0]} ) | ||
DBT_LOG_DIR="${SCRIPT_DIR}/../dbt/logs" | ||
|
||
if [ "$(ls -A ${DBT_LOG_DIR}/dbt.log)" ]; then | ||
echo "${DBT_LOG_DIR}/dbt.log exists. Showing log!!" | ||
sudo cat ${DBT_LOG_DIR}/dbt.log | ||
fi | ||
} | ||
|
||
show_logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.idea | ||
dbt_modules | ||
logs | ||
target | ||
.user.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
#!/usr/bin/env bash | ||
sudo apt-get install -y libsasl2-dev build-essential | ||
pip install agate==1.6.1 airflow-dbt dbt-spark[PyHive] | ||
pip install dbt-core==1.4.5 dbt-spark[PyHive] airflow-dbt-python | ||
|
||
#airflow-dbt-python depends on the fs_default connection | ||
echo "=====================================" | ||
echo "== Configure FS Default connection ==" | ||
echo "=====================================" | ||
airflow connections add fs_default \ | ||
--conn-type fs \ | ||
--conn-extra "{\"path\": \"/\"}" | ||
|
||
sudo chmod -R ugo+rw /opt/airflow/dags/dbt-spark-example/dbt |
Oops, something went wrong.