lawwu
August 24, 2022, 3:53pm
1
Hello,
First time adopter of dbt in the last couple months. I had a question around best practices in handling dbt runs for dev and prod. I’d like to:
Have a daily job that runs dbt run
to target a dev schema
Run dbt test
to make sure all the unit tests pass
Run dbt run --target prod
A couple of questions:
Is this order of operations typical?
We’re using big query. Is it possible to have the the dev target in one GCP “dev” project and the prod target in a GCP “prod” project?
pcreux
August 26, 2022, 10:00am
2
Hello there,
You can definitely target two different GCP projects.
Ex:
# profiles.yml
templates:
bigquery: &bigquery
# run the following command to authenticate:
# $> gcloud auth application-default login --scopes=https://www.googleapis.com/auth/bigquery
dbname: analytics
type: bigquery
method: oauth
threads: 10
timeout_seconds: 300
priority: interactive
retries: 1
default:
outputs:
dev:
<<: *bigquery
project: acme-dev
prod:
<<: *bigquery
project: acme-prod
target: dev
2 Likes
pcreux:
<<: *bigquery
@pcreux I haven’t seen this <<:
syntax before - does this let you take all of the contents of an anchor and then append extra keys? That’s very exciting because it has always annoyed me that I couldn’t make that work!
pcreux
September 27, 2022, 9:18am
4
@joellabes Yes! You’re totally right!
1 Like
obar1
October 16, 2022, 8:34am
5
1 Like
Super interesting. How does that translate to dbt cloud? @pcreux
I currently want to run my production jobs to another gcp project called ‘production’ but when I insert production in the target dbt jobs simply don’t work … any clue on how to approach this?
pcreux
November 28, 2023, 9:28am
7
@emiliobiz98 I’m not familiar with dbt cloud, unfortunately.
No worries, I appreciate the fast answer. Any chance @joellabes ?
You can use Extended Attributes to add things that are configurable in profiles.yml but which dbt Cloud doesn’t expose directly.
They’re not compatible with yaml anchors etc as it’s just a dumb textbox, but it should work for your use case