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

Ability to pass in node and custom_schema_name #75

Open
aaverbec opened this issue Mar 12, 2024 · 2 comments
Open

Ability to pass in node and custom_schema_name #75

aaverbec opened this issue Mar 12, 2024 · 2 comments

Comments

@aaverbec
Copy link

We use a custom generate_schema_name macro for our models. I have been unable to figure out how to duplicate this logic for where it should attempt to place the masking policy. When our ADO pipelines for new PRs are running, it doesn't seem to be able to determine the correct schema to place it in. I can either hard code it using the common schema name variable. Or I can leave it to place it in every schema that a model uses.

In this case, the use common masking policy schema is technically variable. When local dev / PRs (which we use a target.name to determine if it's a PR) then use the default schema. When it's our dev/sandbox/prod dbt environments, use a common schema.

The purpose for this is that we want to use a common schema (I don't need 30 copies of a masking policy in each schema where a model uses them that are all identical), but we don't want people's development creating objects in the "real" schemas either.

@mjahammel
Copy link

I was able to enable this by invoking the custom macro in the variable definition in dbt_project.yml:

common_masking_policy_schema: '{{ generate_schema_name("GOVERNANCE") }}'

@aaverbec
Copy link
Author

@mjahammel I don't believe that would work for our case since our macro has a couple inputs and when I tried to call it, it would tell me that the variables weren't populated.

Beginning of the macro definition
{% macro generate_schema_name(custom_schema_name, node) -%}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants