You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everything in Redshift is mostly the same as in PostgreSQL, so we don't require any changes to:
materializations
get_grant_sql
get_revoke_sql
However, the syntax for showing grants is very different. I think something like this will work, though I'll be the first to admit that it looks & feels pretty weird:
{% macro redshift__get_show_grant_sql(relation) %}
with privileges as (
-- valid options per https://docs.aws.amazon.com/redshift/latest/dg/r_HAS_TABLE_PRIVILEGE.htmlselect'select'as privilege
union allselect'insert'as privilege
union allselect'update'as privilege
union allselect'delete'as privilege
union allselect'references'as privilege
)
selectu.usenameas grantee,
p.privilegefrom pg_user u
cross join privileges p
where has_table_privilege(u.usename, '{{ relation }}', privilege)
{% endmacro %}
Even though that function is called has_table_privilege, it works for both tables + views. Schema-level privileges require using has_schema_privilege instead; not something we need to worry about for now.
Assuming that query is able to return columns by the same name (and we could rename them in the SQL if need be), we shouldn't need to override any other parts of the puzzle.
The text was updated successfully, but these errors were encountered:
Everything in Redshift is mostly the same as in PostgreSQL, so we don't require any changes to:
get_grant_sql
get_revoke_sql
However, the syntax for showing grants is very different. I think something like this will work, though I'll be the first to admit that it looks & feels pretty weird:
Even though that function is called
has_table_privilege
, it works for both tables + views. Schema-level privileges require usinghas_schema_privilege
instead; not something we need to worry about for now.Assuming that query is able to return columns by the same name (and we could rename them in the SQL if need be), we shouldn't need to override any other parts of the puzzle.
The text was updated successfully, but these errors were encountered: