Search code examples
viewsnowflake-cloud-data-platformshare

Command to get Locator of reader account in snowflake


I have a procedure that is having code for share/secure view in snowflake. for that, I have created a reader account. Statement for creating reader account

CREATE MANAGED ACCOUNT if not exists test_acc admin_name='developer123', admin_password='XYZ123temp', type=reader, COMMENT='';

This returns accountName and loginURL when created for 1st time otherwise return test_acc already existed.

I am looking for a statement/command in snowflake so that I can retrieve Locator/accountName for reader accounts.

Note:- Locator is unique 8 char varchar that gets generated for each reader account.


Solution

  • Have you tried "show managed accounts"? It lists the managed accounts created for your account:

    https://docs.snowflake.com/en/sql-reference/sql/show-managed-accounts.html

    It's also possible to list specific account(s) using LIKE:

    show managed accounts like 'GOKHAN_READER';