Publish and subscribe across two accounts

In the test cluster’s sys account, create a tenant, source database, and publication:

CREATE ACCOUNT cookbook_reader ADMIN_NAME 'admin' IDENTIFIED BY '111';
CREATE DATABASE cookbook_pub;
CREATE TABLE cookbook_pub.orders(id INT PRIMARY KEY, amount INT);
INSERT INTO cookbook_pub.orders VALUES(1,10),(2,20);
CREATE PUBLICATION cookbook_orders DATABASE cookbook_pub ACCOUNT cookbook_reader;

Connect to the same instance as cookbook_reader:admin, then run:

CREATE DATABASE cookbook_sub FROM sys PUBLICATION cookbook_orders;
SELECT COUNT(*) AS subscribed_rows, SUM(amount) AS amount_sum
FROM cookbook_sub.orders;

Expect 2 and 30. Insert (3,30) on the publisher; a subsequent subscriber query should return 3 and 60. Subscription tables are read-only. First run DROP DATABASE cookbook_sub as the subscriber. Then, in sys, run DROP PUBLICATION cookbook_orders; DROP DATABASE cookbook_pub; DROP ACCOUNT cookbook_reader;. See the source publication/subscription test.