-
-
Save alex-richman-onesignal/d1e51f2d4e0ae9da80f00457655b2eb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys | |
import psycopg2 | |
conn = psycopg2.connect(sys.argv[1]) | |
conn.set_session(autocommit=True) | |
cursor = conn.cursor() | |
cursor.execute("SELECT pg_drop_replication_slot(slot_name) FROM pg_replication_slots WHERE slot_name LIKE 'test_%';") | |
for index in range(0, 40): | |
print(index) | |
cursor.execute("CHECKPOINT;") | |
cursor.execute(f"SELECT pg_create_logical_replication_slot('test_{index}', 'pgoutput', false);") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment