Skip to content

Posthook grant schema usage #11257

Closed Answered by nstein-gpjoule
nstein-gpjoule asked this question in Q&A
Discussion options

You must be logged in to vote

I accomplished this using a global post-hook and these 3 Macros:

models:
  ...
  +post-hook: "{{ generate_schema_grants(this) }}"

seeds:
  ...
  +post-hook: "{{ generate_schema_grants(this) }}"

Get the Model config:

{% macro get_model_config(model_ref) %}
{% if execute %}
    {%- set model_name = model_ref.identifier -%}
    {% for node in graph.nodes.values() %}
        {%- set curr_model_name = node.unique_id.split('.')[-1] -%}
        {%- if model_name == curr_model_name -%}
            {%- set model_config = node.config -%}
            {{ return(model_config) }}
        {%- endif -%}
    {% endfor %}
{% endif %}
{% endmacro %}

Extract the roles:

{% macro get_model_grant_roles(model_ref

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nstein-gpjoule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant