我可以在 Snowflake 数据库中将 SHOW LOCKS 的内容作为 table 获取吗?

Can I get the contents of SHOW LOCKS as a table in Snowflake database?

命令 SHOW LOCKS IN ACCOUNT 提供以下形式的锁关系:

session resource type transaction transaction_started_on status acquired_on query_id

我想以 table 形式获取相同的信息,以便我可以使用 WHERE 条件,例如:

select system$locks() where transaction_started_on > '2020-01-14 12:33:33'; 

我找不到任何 function that provides the locks or any view in SNOWFLAKE.INFORMATION_SCHEMA 的信息。还有其他方法吗?

您可以使用结果扫描来获取 table show locks 命令。

    show locks in account myaccount;

    select * from table(result_scan(last_query_id())) where "transaction_started_on" > '2020-01-14 12:33:33';