All tables are shared when setting up snow flake sharing

Viewed 38

I created a share in snowflake and assigned permissions to only a few tables. But they can lookup any table. What's the problem?

I ran it with the script below.

CREATE SHARE test_share

GRANT USAGE ON DATABASE "DBNAME" TO SHARE test_share
GRANT USAGE ON SCHEMA "DBNAME"."SCHEMANAME" TO SHARE test_share

GRANT SELECT ON TABLE "DBNAME"."SCHEMANAME"."TABLENAME" TO SHARE test_share

ALTER SHARE sparc_poc_share ADD ACCOUNTS=ConsumerName;
1 Answers

If sharing tables from the same database via different shares with the same consumer account, when the consumer creates a database from one of the shares, all shared tables are visible in the imported database. To prevent this from happening, create a separate schema for each table you wish to share.

Details: https://docs.snowflake.com/en/user-guide/data-sharing-provider.html#general-data-sharing-considerations-and-usage

Recommended practice: https://docs.snowflake.com/en/user-guide/data-sharing-secure-views.html#using-secure-objects-to-control-data-access

Related