Getting Started with Data Sharing¶
Data Sharing is an extremely powerful, yet easy-to-use feature. You can get started as a data provider in just a few simple steps.
This topic introduces the tasks required to share a database and its objects with one or more accounts. The example at the end of the topic illustrates all the SQL commands required to perform these tasks.
In this Topic:
Note
To perform the tasks described in this topic, you must use the ACCOUNTADMIN role.
Also, this topic describes only the minimum set of tasks required for providers to start sharing data. For more detailed information, including more detailed data sharing scenarios, see Working with Shares.
Example¶
The following example illustrates the entire provider process as described above.
Note that this example assumes:
- A database named
sales_db
exists with a schema namedaggregates_eula
and a table namedaggregate_1
.- The database, schema, and table will be shared with two accounts named
consumer_account1
andconsumer_acount2
.USE ROLE accountadmin; CREATE SHARE sales_s; GRANT USAGE ON DATABASE sales_db TO SHARE sales_s; GRANT USAGE ON SCHEMA sales_db.aggregates_eula TO SHARE sales_s; GRANT SELECT ON TABLE sales_db.aggregates_eula.aggregate_1 TO SHARE sales_s; SHOW GRANTS TO SHARE sales_s; ALTER SHARE sales_s ADD ACCOUNTS=consumer_account1, consumer_account2; SHOW GRANTS OF SHARE sales_s;