Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALL_TABLES grant option #23

Open
hkuchi opened this issue May 13, 2021 · 5 comments
Open

ALL_TABLES grant option #23

hkuchi opened this issue May 13, 2021 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@hkuchi
Copy link

hkuchi commented May 13, 2021

Issue Summary

While lakecli is a great tool to view and manage permissions for your lakeformation resources, i think it is missing the ALL_TABLES grant option. For instance, if there are say 500 tables within a database, is it possible to GRANT select on ALL TABLES in database to a principal instead of granting each table at a time?

@vrajat
Copy link
Member

vrajat commented May 14, 2021

boto3 or AWS Lakeformation API does not have the functionality to grant permissions to all tables. The closes is batch_grant_permissions or batch_revoke_permissions. However, these API take a maximum of 20 entries.

The nice part of lakecli is that it can be part of script - bash or python and you can automate granting permissions to a larger set. Happy to discuss if you want to try writing such a script.

@hkuchibhotla
Copy link

hkuchibhotla commented May 21, 2021

Hi Rajat,
Thank you for your response.

Per boto3 documentation, batch_grant_permissions it can take a list of up to 20 entries. However, granting permissions to ALL TABLES within a Database can be performed by using "TableWildcard" option.

TableWildcard (dict) --
A wildcard object representing every table under a database.

Ref: batch_grant_permissions

Alternatively, this works via the CLI as well:

aws lakeformation grant-permissions --principal DataLakePrincipalIdentifier=<ARN_OF_THE_IAM_PRINCIPAL> 
 --permissions "SELECT" --resource '{"Table": {"DatabaseName": "<DBNAME>", "TableWildCard": {} } }'

The above command grants SELECT access to ALL TABLES within the to the IAM principal.

Wonder if this feature could be added to lakecli, that would make it way easier to work with databases containing large number of tables. Apart from this limitation, found lakecli to be useful to view/ query permissions in a SQL-like dialect and to grant individual permissions!

Thanks.

@vrajat
Copy link
Member

vrajat commented May 25, 2021

Thanks for pointing this out. This is a valid feature request and it should be possible to support. I'll add it to the queue. Happy to also accept contributions :)

@vrajat vrajat added the enhancement New feature or request label May 25, 2021
@vrajat vrajat self-assigned this May 25, 2021
@hkuchibhotla
Copy link

Hey @vrajat any idea when this enhancement request is being planned? Happy to pair with you on this.

@vrajat
Copy link
Member

vrajat commented Jun 28, 2021

Hi,
I havent had a chance to work on this feature. Most of my time is spent on tokern/data-lineage. However, I am happy to collaborate, work together to design and accept any contributions.
This will also motivate me to support other feature requests like #17 by integrating tokern/dbcat to pull more info from AWS glue.

Will you be able contribute code for this feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants