page260
347
result += "USE ROLE accountadmin;\n"
result += "ALTER SHARE share_" + P_CLIENT_NAME + " ADD ACCOUNTS = '" +
client_account + "';\n\n"
return result;
$$;
Call
sp_create_share
with your client
POC
.
CALL sp_create_share ( 'POC' );
The
sp_create_share
should return the following SQL statements noting the inline
comments to explain each section.
/* Create a role to manage shared objects */
USE ROLE accountadmin;
CREATE SHARE IF NOT EXISTS share_POC;
/* Create a schema for shared objects */
USE ROLE sysadmin;
CREATE SCHEMA IF NOT EXISTS tpc.share_owner_POC;
/* Entitle new share to access new schema */
GRANT USAGE ON DATABASE tpc TO SHARE share_POC;
GRANT REFERENCE_USAGE ON DATABASE tpc TO SHARE share_POC;
GRANT USAGE ON SCHEMA tpc.share_owner_POC TO SHARE share_POC;
/* Entitle new role to create objects in the new schema */
GRANT USAGE ON SCHEMA tpc.share_owner_POC TO ROLE share_
owner_role;
GRANT CREATE TABLE ON SCHEMA tpc.share_owner_POC TO ROLE share_
owner_role;
GRANT CREATE VIEW ON SCHEMA tpc.share_owner_POC TO ROLE share_
owner_role;
GRANT CREATE MATERIALIZED VIEW ON SCHEMA tpc.share_owner_POC TO ROLE share_
owner_role;
GRANT CREATE DYNAMIC TABLE ON SCHEMA tpc.share_owner_POC TO ROLE share_
owner_role;
CREATE OR REPLACE SECURE VIEW tpc.share_owner_POC.base_customer_order
Chapter 9
Client expeCtations