RubenLaguna
RubenLaguna

Reputation: 24736

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

The command SHOW LOCKS IN ACCOUNT provides a relation of the locks of the form:

session resource type transaction transaction_started_on status acquired_on query_id

I want to get the same information in table form so that I can use WHERE conditions, something like:

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

I can't find any function that provides the locks or any view in SNOWFLAKE.INFORMATION_SCHEMA with this info. Is there any other way to get it?

Upvotes: 1

Views: 883

Answers (1)

Mike Gohl
Mike Gohl

Reputation: 737

You can use result scan to get a table of the show locks command.

    show locks in account myaccount;

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

Upvotes: 1

Related Questions