Skip to content

More about preparing an Amazon Redshift destination

Privileges

Why the user in Create the user and the schema needs each privilege:

Privilege Why it's needed
A database user with a password To connect.
Ownership of the schema (AUTHORIZATION sqdruser) To create tables in it. The tables the user creates belong to it, so it can alter, truncate and drop them, and read and change their rows, without other grants.

Test the privileges

The privileges are first used when a subscription runs. When you create subscriptions, you can test them first with a snapshot subscription of a small table. Its replication events show each step and any Redshift error; permission denied for schema means the user can't create tables there.

Tables in a schema the user doesn't own

To create the tables in an existing schema another user owns, grant the use of the schema and the right to create in it:

GRANT USAGE, CREATE ON SCHEMA myschema TO sqdruser;

The tables the Replicator Service creates there still belong to sqdruser.

Tables owned by another user. For existing tables sqdruser doesn't own, use Use existing table for baseline (incremental) or Use existing table (snapshot) in their subscriptions, so the Replicator Service never creates, alters or drops them, and grant the table privileges:

GRANT USAGE ON SCHEMA myschema TO sqdruser;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA myschema TO sqdruser;
Privilege Why it's needed
SELECT UPDATE and DELETE statements whose WHERE clause reads the key columns.
INSERT, UPDATE, DELETE Loading and applying changes.

Only the table's owner, a superuser or a user with the TRUNCATE privilege on the table can truncate it; otherwise, use Delete existing data before replication.