-
Couldn't load subscription status.
- Fork 353
add init_replication description and required permissions #3020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for dlt-hub-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| - Ownership of the publication and tables to add them | ||
| - Superuser privileges if replicating an entire schema | ||
| - `SELECT` on source tables and `CREATE` on the target schema for snapshots | ||
| - Superuser or the `REPLICATION` attribute for replication slot operations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an item 3: users also need ownership of the tables
b81688d to
9372083
Compare
9372083 to
37f1380
Compare
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
docs | 6097a65 | Commit Preview URL Branch Preview URL |
Oct 02 2025, 07:59 AM |
f50f87b to
027b3c3
Compare
| | Name | Description | | ||
| | -------------------- | ----------------------------------------------- | | ||
| | replication_resource | Load published messages from a replication slot | | ||
| | init_replication | Initialize replication and optionally return snapshot resources for initial data load | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VioletM thought it makes sense to add it here, because it does serve as a resource 👀
027b3c3 to
6097a65
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of comments
| ... | ||
| ``` | ||
|
|
||
| `slot_name`: Name of the replication slot to create if it does not exist yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is just a copy-past from the verified-source repo. Do you think it makes sense to leave it here? I think it will only create an additional place to edit together with the code :)
|
|
||
| ### Snapshot resources from `init_replication` | ||
|
|
||
| The `init_replication` function serves two main purposes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usage of init_replication is kind of complex also because of all the permissions. I would also add:
The example below make use of the `init_replication` helper from the `pg_replication` source.
When you run `init_replication`, Postgres is prepared for logical replication: a publication is created and tables (or the whole schema) are added, a replication slot is created, and—if `persist_snapshots=True` snapshot tables are generated to capture the initial state.
To perform these steps your Postgres user needs the following permissions:
- `CREATE` on the database (or superuser) to create publications
- Ownership of the publication and tables to add them
- Superuser privileges if replicating an entire schema
- `SELECT` on source tables and `CREATE` on the target schema for snapshots
- Superuser or the `REPLICATION` attribute for replication slot operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for taking care of it @anuunchin !
This PR is a twin PR to the one in verified sources.
Relates to 640 in verified sources.