Skip to content

Commit 7be39d1

Browse files
Enhance logging in grant_object macro to include detailed information about grants and roles being processed
1 parent 882a3db commit 7be39d1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

macros/grants/grant_object.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{% set execute_statements = [] %}
77

88
{% for object in objects %}
9-
{% do log("====> Processing " ~ object_type ~ " for " ~ object, info=True) %}
9+
{% do log("====> Processing " ~ object_type ~ " for " ~ object ~ " with grants " ~ grant_types | join(", ") ~ " and roles " ~ grant_roles | join(", "), info=True) %}
1010
{% set query %}
1111
show grants on {{ object_type }} {{ target.database }}.{{ object }};
1212
{% endset %}
@@ -26,13 +26,16 @@
2626
{% endif %}
2727
{% endfor %}
2828
{% for role in grant_roles %}
29+
{% do log("====> Checking " ~ object_type ~ " for " ~ object ~ " with role " ~ role, info=True) %}
2930
{% set existing_role_grants = [] %}
3031
{% for existing_grant in existing_grants %}
3132
{% if existing_grant.role == role %}
3233
{{ existing_role_grants.append(existing_grant.privilege) }}
3334
{% endif %}
3435
{% endfor %}
36+
{% do log("====> Checking " ~ object_type ~ " for " ~ object ~ " with role " ~ role ~ " : existing_role_grants - " ~ existing_role_grants | join(", "), info=True) %}
3537
{% for privilege in grant_types %}
38+
{% do log("====> Checking " ~ object_type ~ " for " ~ object ~ " with privilege " ~ privilege, info=True) %}
3639
{% if privilege not in existing_role_grants %}
3740
{{ grant_statements.append({ "privilege" : privilege, "role" : role, "object" : object }) }}
3841
{% endif %}

0 commit comments

Comments
 (0)