Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Snowflake cloud data platform 需要识别创建表的用户,而不是角色_Snowflake Cloud Data Platform - Fatal编程技术网

Snowflake cloud data platform 需要识别创建表的用户,而不是角色

Snowflake cloud data platform 需要识别创建表的用户,而不是角色,snowflake-cloud-data-platform,Snowflake Cloud Data Platform,我试图将一个对象(表)关联回创建它的用户。由于对象由活动角色拥有,如何获取由单个用户创建的表列表?我已经搜索了create table语句的查询历史记录,但正在寻找更好的解决方案。这样做是否有帮助,或者您现在正在做什么?我认为这是目前可用的主要解决方案。当然,您可以根据需要更改过滤器,包括按特定用户或时间段进行过滤 use role accountadmin; use schema snowflake.account_usage; select q.start_time created_time

我试图将一个对象(表)关联回创建它的用户。由于对象由活动角色拥有,如何获取由单个用户创建的表列表?我已经搜索了create table语句的查询历史记录,但正在寻找更好的解决方案。

这样做是否有帮助,或者您现在正在做什么?我认为这是目前可用的主要解决方案。当然,您可以根据需要更改过滤器,包括按特定用户或时间段进行过滤

use role accountadmin;
use schema snowflake.account_usage;
select q.start_time created_time, q.user_name, t.table_name, q.query_text, t.table_schema schemas_name, T.table_catalog database_name from query_history q
inner join tables t 
on q.start_time = t.created
and q.schema_name = t.table_schema
and q.database_name = t.table_catalog
and q.query_text ilike 'create%table%'
and q.start_time > '2020-11-04 11:13:54'
order by q.start_time;

您应该能够使用这样的查询来完成此操作

use schema snowflake.account_usage;    
select *
    from QUERY_HISTORY
    where 
    database_name = 'TPCDS'
    and query_type = 'CREATE'
    ;

我认为唯一的解决方案是查看
QUERY\u HISTORY
为CREATETABLE语句添加角色名称,这将回答这个问题。