{"id":451,"date":"2024-08-11T07:54:44","date_gmt":"2024-08-11T07:54:44","guid":{"rendered":"https:\/\/datadandies.nl\/?p=451"},"modified":"2024-08-11T07:54:44","modified_gmt":"2024-08-11T07:54:44","slug":"query-results-from-functions-like-show-users-as-if-it-was-a-table-using-table-and-result_scan","status":"publish","type":"post","link":"https:\/\/datadandies.nl\/index.php\/2024\/08\/11\/query-results-from-functions-like-show-users-as-if-it-was-a-table-using-table-and-result_scan\/","title":{"rendered":"Query results from functions like SHOW USERS as if it was a table using TABLE and RESULT_SCAN"},"content":{"rendered":"\n<p>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).<\/p>\n\n\n\n<p>The results of these commands are shown like tables however, you cannot filter them like SHOW USERS WHERE \u2026<\/p>\n\n\n\n<p>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:<\/p>\n\n\n\n<p>show users<\/p>\n\n\n\n<p>;<\/p>\n\n\n\n<p>&#8211;Copy the query ID<\/p>\n\n\n\n<p>select<\/p>\n\n\n\n<p>*<\/p>\n\n\n\n<p>from table( result_scan( paste_the_query_id ) )<\/p>\n\n\n\n<p>&#8212; from table(result_scan(last_query_id())) &#8211;Or use this to use the latest query ID ;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 \u2026 You can however use the commands TABLE and&hellip;<\/p>\n<p class=\"more-link\"><a href=\"https:\/\/datadandies.nl\/index.php\/2024\/08\/11\/query-results-from-functions-like-show-users-as-if-it-was-a-table-using-table-and-result_scan\/\" class=\"themebutton\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[40,4],"class_list":["post-451","post","type-post","status-publish","format-standard","hentry","category-blog","tag-snowflake","tag-sql"],"_links":{"self":[{"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/posts\/451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/comments?post=451"}],"version-history":[{"count":1,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/posts\/451\/revisions"}],"predecessor-version":[{"id":452,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/posts\/451\/revisions\/452"}],"wp:attachment":[{"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/media?parent=451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/categories?post=451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/datadandies.nl\/index.php\/wp-json\/wp\/v2\/tags?post=451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}