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

check-model-parents-schema not running as expected #135

Open
kiliantscherny opened this issue Jun 1, 2023 · 0 comments
Open

check-model-parents-schema not running as expected #135

kiliantscherny opened this issue Jun 1, 2023 · 0 comments
Labels
bug Something isn't working priority: low

Comments

@kiliantscherny
Copy link

kiliantscherny commented Jun 1, 2023

Describe the bug

PR with a proposed backwards-compatible fix and more information: #132

check-model-parents-schema does not work as expected. Because the schema is parsed from nodes → schema as dev_dim_schema_name rather than dim_schema_name (which is found in nodes → config → schema), the check doesn't work as expected.

Essentially, the schema being parsed is the wrong schema.
Incorrect: nodes → schema
Correct: nodes → config → schema

To Reproduce
Steps to reproduce the behavior:

  1. Run the check locally:
- id: check-model-parents-schema
    args: ["--whitelist", "allowed_schema_name", "--"]

Replacing allowed_schema_name with the allowed schema name for whitelist or a disallowed one for blacklist.
3. Check the output and if the failure is like the below then it's an issue:

Check parent models or sources are from certain schema.......................Failed
- hook id: check-model-parents-schema
- exit code: 1

example_int_model: has parent example_stg_model with invalid schema dbt_myproject_test_kilian_tscherny_allowed_schema_name.

We can see here than technically the parent model does have the allowed_schema_name but because it is prefixed by the name of my own output dev dataset (dbt_myproject_test_kilian_tscherny), it's flagged as an error.

Expected behavior
The check should be selecting from the "nested" schema that's inside config, we get the "true" schema name reliably every time, for each developer and in production.

Version:
v1.1.0

Additional context
I've tested this on 2 separate BigQuery-based projects as well as 1 Snowflake-based project and had the same issue.

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

No branches or pull requests

2 participants