Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Skip cache lookups for external nodes while resolving deferred references #11201

Open
2 tasks done
Tracked by #10125
jtcohen6 opened this issue Jan 8, 2025 · 1 comment
Open
2 tasks done
Tracked by #10125
Labels
bug Something isn't working multi_project

Comments

@jtcohen6
Copy link
Contributor

jtcohen6 commented Jan 8, 2025

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

Full context in internal slack thread

If I am:

  • resolving references to an upstream public model (which dbt-core understands as an "external" node)
  • with deferral enabled
  • and I don't have metadata permissions on the schema containing that upstream public model (unusual, but it does happen)

Then I'll get a failure like (BigQuery):

403 GET https://bigquery.googleapis.com/bigquery/v2/projects/...: Access Denied: Table ...: Permission bigquery.tables.get denied on table ... (or it may not exist).

Expected Behavior

Because enabling deferral (--defer) won't actually change which reference dbt will use for upstream public models (external nodes), regardless of whether the object exists or not, there's no reason to attempt a cache lookup for it in RuntimeRefResolver.create_relation.

dbt already excludes external nodes from initial cache population here.

Steps To Reproduce

  1. Define a model with a reference to an upstream public model in another project, in a schema that you do not have permission to access.
  2. dbt compile that model - succeeds. (Note that it will still fail at runtime.)
  3. Try compiling again with deferral enabled (dbt compile --defer) - fails, because dbt attempts a cache lookup that isn't strictly necessarily.

Relevant log output

No response

Environment

- dbt: latest

Which database adapter are you using with dbt?

No response

Additional Context

No response

@eivind-stb
Copy link

I'm not sure if this is valuable input, but from the way we experience it:

If I am (in dbt-cloud):

  • build a dbt-model that references an upstream public model
  • and I have metadata permissions on the schema containing that upstream public model
  • but the public model itself has upstream references to a database I do not have access to
  • and the dbt-job is specified with Generate docs on run turned on.

Then dbt build works, but I'll get a failure if:

  • the public model is referenced by a dbt-model that runs in a different database that I do not have access to (which is by design) with the error ['database that the public model is not in' does not exist or not authorized].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working multi_project
Projects
None yet
Development

No branches or pull requests

2 participants