Skip to content

Commit

Permalink
Demo/bigquery (#16)
Browse files Browse the repository at this point in the history
* update configs

* update profile

* draft PR

---------

Co-authored-by: Sung Won Chung <[email protected]>
  • Loading branch information
sungchun12 and Sung Won Chung authored Sep 26, 2023
1 parent 97feb05 commit 61e97f4
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 114 deletions.
62 changes: 0 additions & 62 deletions .github/workflows/cloud_run.yml

This file was deleted.

6 changes: 3 additions & 3 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: "jaffle_shop"
# Specify a requirement on an _exact_ version of dbt
require-dbt-version: 0.19.0
# require-dbt-version: 0.19.0
version: 1.0.0
config-version: 2
profile: "jaffle_shop"
source-paths: ["models"]
model-paths: ["models"]
analysis-paths: ["analysis"]
test-paths: ["tests"]
data-paths: ["data"]
seed-paths: ["data"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"] # https://docs.getdbt.com/docs/snapshots#section-what-are-snapshots-

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:

env:
#TODO(developer): update PROJECT_ID
PROJECT_ID: "dvc-demo-297316"
PROJECT_ID: "dbt-demo-386220"
DBT_PROFILES_DIR: ./
DBT_GOOGLE_BIGQUERY_KEYFILE: ./service_account.json
GOOGLE_APPLICATION_CREDENTIALS: ./service_account.json

jobs:
dbt:
Expand All @@ -28,7 +28,7 @@ jobs:
- run: 'echo "$KEYFILE" > ./service_account.json' # persist file in root dir
shell: bash
env:
KEYFILE: ${{secrets.DBT_GOOGLE_BIGQUERY_KEYFILE}} # add a github secret
KEYFILE: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}} # add a github secret
# run actual dbt commands
- run: dbt debug --target service_account_runs
- run: dbt seed --full-refresh --show --target service_account_runs
Expand Down
2 changes: 1 addition & 1 deletion models/sources/sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2

sources:
- name: dbt_bq_example
database: "{{ env_var('PROJECT_ID', 'dvc-demo-297316') }}"
database: "{{ env_var('PROJECT_ID', 'dbt-demo-386220') }}"
schema: dbt_bq_example

freshness:
Expand Down
21 changes: 4 additions & 17 deletions profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,12 @@ jaffle_shop:
target: dev
outputs:
dev:
type: bigquery
method: oauth # for production runs: https://docs.getdbt.com/docs/profile-bigquery#section-service-account-file-authentication
project: "{{ env_var('PROJECT_ID', 'wam-bam-258119') }}" # parameterize project for dbt runs based on environment variable with default project
dataset: dbt_bq_example # You can also use "schema" here, can add env_var here if desired
threads: 8 # https://docs.getdbt.com/docs/configure-your-profile#section-understanding-threads
timeout_seconds: 300
location: US # Optional, one of US or EU
priority: interactive # interactive or batch

# use the below for service account authenticated dbt runs
service_account_runs:
type: bigquery
method: service-account # for production runs: https://docs.getdbt.com/docs/profile-bigquery#section-service-account-file-authentication
project: "{{ env_var('PROJECT_ID', 'wam-bam-258119') }}" # parameterize project for dbt runs based on environment variable with default project
dataset: dbt_bq_example # You can also use "schema" here
threads: 8 # https://docs.getdbt.com/docs/configure-your-profile#section-understanding-threads
keyfile: "{{ env_var('DBT_GOOGLE_BIGQUERY_KEYFILE', 'service_account.json') }}"
project: "{{ env_var('PROJECT_ID', 'dbt-demo-386220') }}" # parameterize project for dbt runs based on environment variable with default project
dataset: dbt_sung # You can also use "schema" here
threads: 24 # https://docs.getdbt.com/docs/configure-your-profile#section-understanding-threads
keyfile: "{{ env_var('GOOGLE_APPLICATION_CREDENTIALS', 'service_account.json') }}"
timeout_seconds: 300
location: US # Optional, one of US or EU
priority: interactive # interactive or batch
config:
send_anonymous_usage_stats: False
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dbt==0.19.0
dbt-bigquery==1.6.5
27 changes: 0 additions & 27 deletions snapshots/orders_snapshot.sql

This file was deleted.

0 comments on commit 61e97f4

Please sign in to comment.