Skip to content

Commit

Permalink
chore: Add VSCode settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jo Lares authored and Jo Lares committed Feb 23, 2024
1 parent 55b53b7 commit 909c0f2
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 46 deletions.
18 changes: 3 additions & 15 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
- name: Checkout repository code
uses: actions/checkout@v4

- run: sh variable_substitution.sh

- run: sh setup.sh

- run: dbt compile
Expand All @@ -40,6 +38,7 @@ jobs:
id-token: 'write'
env:
DBT_PROJECT_NAME: dbt_demo
DBT_WAREHOUSE_PROVIDER: 'snowflake'
DBT_PROFILES_DIR: '.'
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_DATABASE: ${{ secrets.SNOWFLAKE_DATABASE }}
Expand All @@ -60,6 +59,7 @@ jobs:
id-token: 'write'
env:
DBT_PROJECT_NAME: dbt_demo
DBT_WAREHOUSE_PROVIDER: 'snowflake'
DBT_PROFILES_DIR: '.'
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_DATABASE: ${{ secrets.SNOWFLAKE_DATABASE }}
Expand All @@ -71,8 +71,6 @@ jobs:
- name: Checkout repository code
uses: actions/checkout@v4

- run: sh variable_substitution.sh

- run: sh setup.sh

- run: dbt test
Expand All @@ -84,6 +82,7 @@ jobs:
id-token: 'write'
env:
DBT_PROJECT_NAME: dbt_demo
DBT_WAREHOUSE_PROVIDER: 'snowflake'
DBT_PROFILES_DIR: '.'
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_DATABASE: ${{ secrets.SNOWFLAKE_DATABASE }}
Expand Down Expand Up @@ -112,17 +111,6 @@ jobs:
- name: Checkout repository code
uses: actions/checkout@v4

- run: sh variable_substitution.sh

- run: sh setup.sh

- run: dbt run









4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.defaultInterpreterPath": "${cwd}/.venv/bin/python",
"python.terminal.activateEnvironment": true
}
File renamed without changes.
1 change: 0 additions & 1 deletion models/example/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ models:
description: "The primary key for this table"
tests:
- unique
- not_null

- name: my_second_dbt_model
description: "A starter dbt model"
Expand Down
60 changes: 30 additions & 30 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,50 @@

##
## Setup runner configuration
## Validate runner configuration variables
##

if [[ -z "${DBT_PROJECT_NAME}" ]]; then
if [ -z "${DBT_PROJECT_NAME}" ]; then
echo "Environment variable DBT_PROJECT_NAME is not set"
exit 1
fi

if [[ -z "${DBT_PROFILES_DIR}" ]]; then
if [ -z "${DBT_PROFILES_DIR}" ]; then
# Note: the value used by dbt when --profiles-dir is not is "/Users/<USER>/.dbt"
echo "Environment variable DBT_PROFILES_DIR is not set"
exit 1
fi

if [[ -z "${DBT_WAREHOUSE_PROVIDER}" ]]; then
if [ -z "${DBT_WAREHOUSE_PROVIDER}" ]; then
echo "Environment variable DBT_WAREHOUSE_PROVIDER is not set"
exit 1
fi

##
## Perform Environment-Specific variable subtitutions
##

if [ "$DBT_WAREHOUSE_PROVIDER" = "snowflake" ]; then
cp dbt_profiles.snowflake.yml profiles.yml

sed -i "s/__SNOWFLAKE_ACCOUNT__/${SNOWFLAKE_ACCOUNT}/g" profiles.yml
sed -i "s/__SNOWFLAKE_DATABASE__/${SNOWFLAKE_DATABASE}/g" profiles.yml
sed -i "s/__SNOWFLAKE_PASSWORD__/${SNOWFLAKE_PASSWORD}/g" profiles.yml
sed -i "s/__SNOWFLAKE_ROLE__/${SNOWFLAKE_ROLE}/g" profiles.yml
sed -i "s/__SNOWFLAKE_USER__/${SNOWFLAKE_USER}/g" profiles.yml
sed -i "s/__SNOWFLAKE_WAREHOUSE__/${SNOWFLAKE_WAREHOUSE}/g" profiles.yml

elif [ "$DBT_WAREHOUSE_PROVIDER" = "bigquery" ]; then
cp dbt_profiles.bigquery.yml profiles.yml

# TODO:
# sed -i "s/__SNOWFLAKE_ACCOUNT__/${SNOWFLAKE_ACCOUNT}/g" profiles.yml
# sed -i "s/__SNOWFLAKE_DATABASE__/${SNOWFLAKE_DATABASE}/g" profiles.yml
# sed -i "s/__SNOWFLAKE_PASSWORD__/${SNOWFLAKE_PASSWORD}/g" profiles.yml
# sed -i "s/__SNOWFLAKE_ROLE__/${SNOWFLAKE_ROLE}/g" profiles.yml
# sed -i "s/__SNOWFLAKE_USER__/${SNOWFLAKE_USER}/g" profiles.yml
# sed -i "s/__SNOWFLAKE_WAREHOUSE__/${SNOWFLAKE_WAREHOUSE}/g" profiles.yml
fi

##
## Install system dependencies
##
Expand Down Expand Up @@ -49,32 +75,6 @@ elif [ "$DBT_WAREHOUSE_PROVIDER" = "bigquery" ]; then
pip install dbt-bigquery
fi

##
## Perform Environment-Specific variable subtitutions
##

if [ "$DBT_WAREHOUSE_PROVIDER" = "snowflake" ]; then
cp dbt_profiles.snowflake.yml profiles.yml

sed -i "s/__SNOWFLAKE_ACCOUNT__/${SNOWFLAKE_ACCOUNT}/g" profiles.yml
sed -i "s/__SNOWFLAKE_DATABASE__/${SNOWFLAKE_DATABASE}/g" profiles.yml
sed -i "s/__SNOWFLAKE_PASSWORD__/${SNOWFLAKE_PASSWORD}/g" profiles.yml
sed -i "s/__SNOWFLAKE_ROLE__/${SNOWFLAKE_ROLE}/g" profiles.yml
sed -i "s/__SNOWFLAKE_USER__/${SNOWFLAKE_USER}/g" profiles.yml
sed -i "s/__SNOWFLAKE_WAREHOUSE__/${SNOWFLAKE_WAREHOUSE}/g" profiles.yml

elif [ "$DBT_WAREHOUSE_PROVIDER" = "bigquery" ]; then
cp dbt_profiles.bigquery.yml profiles.yml

# TODO:
# sed -i "s/__SNOWFLAKE_ACCOUNT__/${SNOWFLAKE_ACCOUNT}/g" profiles.yml
# sed -i "s/__SNOWFLAKE_DATABASE__/${SNOWFLAKE_DATABASE}/g" profiles.yml
# sed -i "s/__SNOWFLAKE_PASSWORD__/${SNOWFLAKE_PASSWORD}/g" profiles.yml
# sed -i "s/__SNOWFLAKE_ROLE__/${SNOWFLAKE_ROLE}/g" profiles.yml
# sed -i "s/__SNOWFLAKE_USER__/${SNOWFLAKE_USER}/g" profiles.yml
# sed -i "s/__SNOWFLAKE_WAREHOUSE__/${SNOWFLAKE_WAREHOUSE}/g" profiles.yml
fi

# Confirm that the dbt installation was successful.
dbt --version

Expand Down

0 comments on commit 909c0f2

Please sign in to comment.