SHOW SHARES

Lists all shares available in the system:

  • Outbound shares (to consumers) that have been created in your account (as a provider).

  • Inbound shares (from providers) that are available for your account to consume.

See also:

CREATE SHARE , ALTER SHARE , DROP SHARE , DESCRIBE SHARE

Syntax

SHOW SHARES [ LIKE '<pattern>' ]
            [ LIMIT <rows> [ FROM '<name_string>' ] ]
Copy

Parameters

LIKE 'pattern'

Optionally filters the command output by object name. The filter uses case-insensitive pattern matching, with support for SQL wildcard characters (% and _).

For example, the following patterns return the same results:

... LIKE '%testing%' ...
... LIKE '%TESTING%' ...

. Default: No value (no filtering is applied to the output).

STARTS WITH 'name_string'

Optionally filters the command output based on the characters that appear at the beginning of the object name. The string must be enclosed in single quotes and is case-sensitive.

For example, the following strings return different results:

... STARTS WITH 'B' ...
... STARTS WITH 'b' ...

. Default: No value (no filtering is applied to the output)

LIMIT rows [ FROM 'name_string' ]

Optionally limits the maximum number of rows returned, while also enabling “pagination” of the results. The actual number of rows returned might be less than the specified limit. For example, the number of existing objects is less than the specified limit.

The optional FROM 'name_string' subclause effectively serves as a “cursor” for the results. This enables fetching the specified number of rows following the first row whose object name matches the specified string:

  • The string must be enclosed in single quotes and is case-sensitive.

  • The string does not have to include the full object name; partial names are supported.

Default: No value (no limit is applied to the output)

Note

For SHOW commands that support both the FROM 'name_string' and STARTS WITH 'name_string' clauses, you can combine both of these clauses in the same statement. However, both conditions must be met or they cancel out each other and no results are returned.

In addition, objects are returned in lexicographic order by name, so FROM 'name_string' only returns rows with a higher lexicographic value than the rows returned by STARTS WITH 'name_string'.

For example:

  • ... STARTS WITH 'A' LIMIT ... FROM 'B' would return no results.

  • ... STARTS WITH 'B' LIMIT ... FROM 'A' would return no results.

  • ... STARTS WITH 'A' LIMIT ... FROM 'AB' would return results (if any rows match the input strings).

Usage Notes

  • The command lists shares only for users with a role that has the IMPORT SHARE privilege:

    Note

    Executing this command without sufficient privileges returns empty results.

  • Columns that start with the prefix is_ return either Y (yes) or N (no).

  • The command does not require a running warehouse to execute.

  • The command returns a maximum of 10K records for the specified object type, as dictated by the access privileges for the role used to execute the command; any records above the 10K limit are not returned, even with a filter applied.

    To view results for which more than 10K records exist, query the corresponding view (if one exists) in the Snowflake Information Schema.

  • To post-process the output of this command, you can use the RESULT_SCAN function, which treats the output as a table that can be queried.

Output

  • The kind column displays:

    • INBOUND indicates the share is available to your account to consume (i.e. you can create a database from the share).

    • OUTBOUND indicates that your account is sharing data with other accounts and this share was created in your account.

  • For OUTBOUND shares, if accounts have been added to the share, the to column displays these accounts. The maximum number of accounts displayed in this column is three; however, there is no hard limit on the number of accounts that can be added to a share.

Examples

Show all shares that have been created in your account or are available to consume by your account:

SHOW SHARES;

+-------------------------------+----------+----------------------+---------------+-----------------------+------------------+--------------+----------------------------------------+---------------------+
| created_on                    | kind     | owner_account        | name          | database_name         | to               | owner        | comment                                | listing_global_name |                  |
|-------------------------------+----------+----------------------+---------------+-----------------------+------------------+--------------+----------------------------------------|---------------------|
| 2016-07-09 19:18:09.821 -0700 | INBOUND  | SNOW.MY_TEST_ACCOUNT | SAMPLE_DATA   | SNOWFLAKE_SAMPLE_DATA |                  |              | Sample data sets provided by Snowflake |                     |
| 2017-06-15 17:02:29.625 -0700 | OUTBOUND | SNOW.MY_TEST_ACCOUNT | SALES_S       | SALES_DB              | XY12345, YZ23456 | ACCOUNTADMIN |                                        |                     |
+-------------------------------+----------+----------------------+---------------+-----------------------+------------------+--------------+----------------------------------------+---------------------+
Copy

Show all shares that have been created in your account or are available to consume by your account that include the string ‘SNOW’:

SHOW SHARES LIMIT 5 FROM 'SNOW';

+-------------------------------+----------+-------------------------+-----------------+----------------+------------------+--------------+---------+---------------------+
| created_on                    | kind     | owner_account           | name            | database_name  | to               | owner        | comment | listing_global_name |
|-------------------------------+----------+-------------------------+-----------------+----------------+------------------+--------------+---------+---------------------|
| 2020-07-07 19:18:09.821 -0700 | OUTBOUND | SNOW.MY_TEST_ACCOUNT    | SNOW_DATA       | EXAMPLE        |                  | ACCOUNTADMIN |         |                     |
| 2020-07-10 19:18:09.821 -0700 | OUTBOUND | SNOW.MY_TEST_ACCOUNT    | DATA_SNOWS      | EXAMPLE        |                  | ACCOUNTADMIN |         |                     |
| 2022-08-18 12:02:29.625 -0700 | OUTBOUND | SNOW.MY_TEST_ACCOUNT    | SNOW_DATA       | ALFALFA_DB     | AB12345, YZ23456 | ACCOUNTADMIN |         |                     |
| 2022-08-18 13:04:29.625 -0700 | OUTBOUND | SNOW.MY_TEST_ACCOUNT    | SNOW_SHARE      | SALES_DB       | AB12345          | ACCOUNTADMIN |         |                     |
| 2022-08-18 14:02:40.625 -0700 | OUTBOUND | SNOW.MY_TEST_ACCOUNT    | SNOWIER_SHARE   | SALES_DB       |                  | ACCOUNTADMIN |         |                     |
+-------------------------------+----------+-------------------------+-----------------+----------------+------------------+--------------+---------+---------------------+
Copy

Show all shares that have been created in your account or are available to consume by your account that start with SNOW, sorted in lexicographic order:

SHOW SHARES STARTS WITH 'SNOW' LIMIT 5 FROM 'A';

+-------------------------------+----------+------------------------+------------------------+----------------+------------------+--------------+---------+---------------------+
| created_on                    | kind     | owner_account          |  name                  | database_name  | to               | owner        | comment | listing_global_name |
|-------------------------------+----------+------------------------+------------------------+----------------+------------------+--------------+---------+---------------------|
| 2020-07-07 19:18:09.821 -0700 | OUTBOUND | SNOW.MY_TEST_ACCOUNT   | SNOW_DATA              | EXAMPLE        |                  | ACCOUNTADMIN |         |                     |
| 2022-08-18 12:02:29.625 -0700 | OUTBOUND | SNOW.MY_TEST_ACCOUNT   | SNOW_DATA              | ALFALFA_DB     | AB12345, YZ23456 | ACCOUNTADMIN |         |                     |
| 2022-08-18 14:02:40.625 -0700 | OUTBOUND | SNOW.MY_TEST_ACCOUNT   | SNOWIER_SHARE          | SALES_DB       |                  | ACCOUNTADMIN |         |                     |
| 2022-08-20 15:03:50.625 -0700 | OUTBOUND | SNOW.MY_TEST_ACCOUNT   | SNOWY_SHARE            | SALES_DB       |                  | ACCOUNTADMIN |         |                     |
| 2022-08-18 13:04:29.625 -0700 | OUTBOUND | SNOW.MY_TEST_ACCOUNT   | SNOW_SHARE             | SALES_DB       | AB12345          | ACCOUNTADMIN |         |                     |
+-------------------------------+----------+------------------------+------------------------+----------------+------------------+--------------+---------+---------------------+
Copy