Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to assign table ownership to multiple users or group in Redshift

I was wondering if there is a way how to assign table owner to a group or to multiple users in Redshift? If not, is there any workaround you use to solve this need?

Thanks for any tips.

like image 302
Jakub Dvorak Avatar asked Nov 30 '17 12:11

Jakub Dvorak


People also ask

How do I assign a user to a group in Redshift?

Adding user to the group To add an existing user to an existing group, run the following query in Redshift. ALTER GROUP group_name ADD USER user 1; The above query will add user_1 into an existing group group_name in the Redshift. Similarly, a user can be removed from a group in Redshift using the ALTER GROUP command.

How do I give someone access to my table in Redshift?

To grant usage of external tables in an external schema, grant USAGE ON SCHEMA to the users that need access. Only the owner of an external schema or a superuser is permitted to create external tables in the external schema. To transfer ownership of an external schema, use ALTER SCHEMA to change the owner.

How do I check group permissions in Redshift?

To view assigned roles to users in your Redshift cluster, you can use the following command: SELECT usename AS user_name, groname AS group_name FROM pg_user, pg_group WHERE pg_user.

How do I manage users in Redshift?

Creating, altering, and deleting users To create a user, use the CREATE USER command. To create a superuser, use the CREATE USER command with the CREATEUSER option. To remove an existing user, use the DROP USER command. To change a user account, for example changing a password, use the ALTER USER command.


1 Answers

My understanding is that there is no way to achieve this seemingly desirable state. It seems to be how Redshift is designed.

The only work-around I am aware of is to either have the 'owner' of the object' execute any commands that required 'owner' privilege, or to have the owner run a command to transfer (note not 'confer' sadly) the ownership of the object to the target user that wishes to make modifications.

alter table test.test_table owner to test_user;

After executing the above, test_user will be the owner of test.test_table, and would be able to perform 'owner-only' commands such as alter/drop/vacuum etc.

like image 144
Vince Hill Avatar answered Sep 19 '22 15:09

Vince Hill