{% macro APPLY(conn, schema_name, table_object, column_object, role, privs, with_grant_privs) -%}
{% if privs %}
GRANT {% for p in privs %}{% if loop.index != 1 %}, {% endif %}{{p}}({{conn|qtIdent(column_object)}}){% endfor %}
 ON {{ conn|qtIdent(schema_name, table_object) }} TO {{ role }};
{% endif %}
{% if with_grant_privs %}
GRANT {% for p in with_grant_privs %}{% if loop.index != 1 %}, {% endif %}{{p}}({{conn|qtIdent(column_object)}}){% endfor %}
 ON {{ conn|qtIdent(schema_name, table_object) }} TO {{ role }} WITH GRANT OPTION;
{% endif %}
{%- endmacro %}
{% macro RESETALL(conn, schema_name, table_object, column_object, role) -%}
REVOKE ALL({{ conn|qtIdent(column_object) }}) ON {{ conn|qtIdent(schema_name, table_object) }} FROM {{ role }};
{%- endmacro %}