Closed jcarpenter12 closed 2 weeks ago
@jcarpenter12 amazing and thorough write up!
What I still need help on is:
Here you can see the quota project is causing this connection to fail even though it is not specified anywhere in the dbt profile itself and is instead being picked up from the environment
@jcarpenter12 amazing and thorough write up!
What I still need help on is:
- what the expected behavior of your reproducible example should be. Like what should be happening?
Here you can see the quota project is causing this connection to fail even though it is not specified anywhere in the dbt profile itself and is instead being picked up from the environment
disambiguating:
- your reproducible example that highlights that something funny is happening when multiple projects are set up
- the behavior discovered that workloads aren't properly attributed to quota projects
Thanks for getting back to me so quickly @dataders.
As for 1. I have updated the expected behaviour section with what I believe should be happening according to the docs.
As for 2. you're right it's not very clear. In my example to prove that it is picking up the quota project from the environment I created a new project that does not have the BQ api enabled
in it. This way dbt debug would fail the connection because there is no quota it can access but prove that it is incorrectly trying to use the quota project from the environment rather than from the profiles.yml
.
If i had set a project in my gcloud using gcloud config set project $MY_QUOTA_PROJECT
that did have the BQ api enabled in it the debug command would pass as it would be able to access the quota project. However, this would only disguise the issue as it would appear to be running okay but actually it's attributing the quota usage to the one set in the user's environment.
Please let me know if these aren't suitable and I'll come up with another way to demonstrate the issue as I see it.
Updated the title and contents of the issue. I have been speaking to the maintainers on their slack channel about this and we have managed to narrow down the issue, and the original issue was somewhat misleading
@jcarpenter12 can we close as duplicate of #1343 or will additional work be required for this?
@jcarpenter12 can we close as duplicate of #1343 or will additional work be required for this?
Hi @colin-rogers-dbt no problem with any of that my side. Raised it originally for what I thought was the bug and then a feature for a potential fix. But largely the feature details it the same way anyway and the bug does just clutter things a bit
Is this a new bug in dbt-bigquery?
Current Behavior
When a user or service account's default
quota_project_id
is set to a project other than theexecution_project
specified in theprofiles.yml
DBT will use this as thequota_project_id
in the underlying request opposed to anything set in theprofiles.yml
. This is a side effect and will mean that a DBT will fail to connect to BigQuery if the user does not have BigQuery API enabled in the project their credentials default to. It will also mean that certain quota limits are being used up in the default project.You can see the default quota project_id from the contents of your
application_default_credentials
file. It should look something like this. A similar structure applies to the contents of service account keys I believeThis issue arose when running a CI/CD pipeline that is defined in a project separate to either the
project
orexecution_project
and did not have the BQ API enabled, so it failed to connect.Expected Behavior
What I think should be happening according to the docs
As this is a side effect the expected behaviour is a bit difficult to define but DBT should either set
execution_project
as thequota_project_id
in the BQ client or allow the user to override it themselves in theprofiles.yml
.In my opinion the user should be able to specify a separate optional
quota_project
to use separate fromproject
andexecution project
. By not setting it, it will default to what it does now and not change the behaviour. Feature Request here #1343Steps To Reproduce
foo
gcloud config set project $MY_QUOTA_PROJECT
(replace with the name of step 1)gcloud auth application-default login
cat ~/.config/gcloud/application_default_credentials
. It should look something like the followingpip install dbt-core==1.8.6 dbt-bigquery==1.8.2
profiles-dir
to wherever your profile is locateddbt debug --connection --profiles-dir .
You should then see a log output like the below. Here you can see the quota project is causing this connection to fail even though it is not specified anywhere in the dbt profile itself and is instead being picked up from the environment.
Relevant log output
Environment
Additional Context
This relates to #1343 a feature request to add quota_project and a potential PR for it here #1345
Docs PR : dbt-labs/docs.getdbt.com#6054
As noted on the #1343 I have not raised a change to a dbt adapter before so please do let me know if I am misunderstanding anything