Query results from functions like SHOW USERS as if it was a table using TABLE and RESULT_SCAN

In Snowflake there are useful commands like SHOW USERS (shows the users in your environment) or SHOW GRANTS TO ROLE (shows the privileges given to a certain role).

The results of these commands are shown like tables however, you cannot filter them like SHOW USERS WHERE …

You can however use the commands TABLE and RESULT_SCAN to query the results of the commands listed above as a table. Here is how it would look like:

show users

;

–Copy the query ID

select

*

from table( result_scan( paste_the_query_id ) )

— from table(result_scan(last_query_id())) –Or use this to use the latest query ID ;

Leave Comment

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *