Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit e28bcad

Browse files
committed
Flexible slot name
Add a configuration which allows us to set the name of the replication slot.
1 parent 7d3ef40 commit e28bcad

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

tap_postgres/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,8 @@ def main_impl():
684684
'filter_dbs' : args.config.get('filter_dbs'),
685685
'debug_lsn' : args.config.get('debug_lsn') == 'true',
686686
'logical_poll_total_seconds': float(args.config.get('logical_poll_total_seconds', 0)),
687-
'wal2json_message_format': args.config.get('wal2json_message_format')}
687+
'wal2json_message_format': args.config.get('wal2json_message_format'),
688+
'wal2json_slot_name': args.config.get('wal2json_slot_name')}
688689

689690
if args.config.get('ssl') == 'true':
690691
conn_config['sslmode'] = 'require'

tap_postgres/sync_strategies/logical_replication.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,11 @@ def consume_message(streams, state, msg, time_extracted, conn_info, end_lsn, mes
379379
return state
380380

381381
def locate_replication_slot(conn_info):
382+
if conn_info.get('wal2json_slot_name') is not None:
383+
slot_name = conn_info["wal2json_slot_name"]
384+
LOGGER.info("using pg_replication_slot %s", slot_name)
385+
return slot_name
386+
382387
with post_db.open_connection(conn_info, False) as conn:
383388
with conn.cursor() as cur:
384389
db_specific_slot = "stitch_{}".format(conn_info['dbname'])

0 commit comments

Comments
 (0)