如何将所有角色授予Trino/Presto的用户?

发布于 2025-02-13 23:10:11 字数 103 浏览 2 评论 0原文

基本上,在Trino/Presto中相当于Hive查询的等效物。

show role grant user <username>;

basically what is the equivalent of hive query in trino/presto.

show role grant user <username>;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

刘备忘录 2025-02-20 23:10:11

我们可以从Information_schema获得信息,这是自我解释的,但是我找不到有关此系统定义的模式的文档。

SELECT * 
FROM information_schema.role_authorization_descriptors 
WHERE grantee = 'a_user';

一个更有用的查询是检查用户是否可以访问表

SELECT *
FROM information_schema.table_privileges
WHERE table_schema = 'a_schema'
AND   table_name = 'a_table'
AND   privilege_type = 'SELECT'
AND   (grantee = 'a_user' OR grantee IN (SELECT role_name
                                      FROM information_schema.role_authorization_descriptors
                                      WHERE grantee = 'a_user'));

we can get the information from information_schema it is self explanatory but i cannot find document about this system defined schema.

SELECT * 
FROM information_schema.role_authorization_descriptors 
WHERE grantee = 'a_user';

a more useful query is check whether a user has access to a table

SELECT *
FROM information_schema.table_privileges
WHERE table_schema = 'a_schema'
AND   table_name = 'a_table'
AND   privilege_type = 'SELECT'
AND   (grantee = 'a_user' OR grantee IN (SELECT role_name
                                      FROM information_schema.role_authorization_descriptors
                                      WHERE grantee = 'a_user'));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文