pgbelt 0.6.1__py3-none-any.whl → 0.6.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pgbelt/util/pglogical.py +15 -6
- {pgbelt-0.6.1.dist-info → pgbelt-0.6.2.dist-info}/METADATA +1 -1
- {pgbelt-0.6.1.dist-info → pgbelt-0.6.2.dist-info}/RECORD +6 -6
- {pgbelt-0.6.1.dist-info → pgbelt-0.6.2.dist-info}/LICENSE +0 -0
- {pgbelt-0.6.1.dist-info → pgbelt-0.6.2.dist-info}/WHEEL +0 -0
- {pgbelt-0.6.1.dist-info → pgbelt-0.6.2.dist-info}/entry_points.txt +0 -0
pgbelt/util/pglogical.py
CHANGED
|
@@ -97,17 +97,25 @@ async def configure_replication_set(
|
|
|
97
97
|
"""
|
|
98
98
|
Add each table in the given list to the default replication set
|
|
99
99
|
"""
|
|
100
|
-
logger.info(
|
|
100
|
+
logger.info("Creating new replication set 'pgbelt'")
|
|
101
|
+
async with pool.acquire() as conn:
|
|
102
|
+
try:
|
|
103
|
+
await conn.execute("SELECT pglogical.create_replication_set('pgbelt');")
|
|
104
|
+
logger.debug("Created the 'pgbelt' replication set")
|
|
105
|
+
except Exception as e:
|
|
106
|
+
logger.debug(f"Could not create replication set 'pgbelt': {e}")
|
|
107
|
+
|
|
108
|
+
logger.info(f"Configuring 'pgbelt' replication set with tables: {tables}")
|
|
101
109
|
for table in tables:
|
|
102
110
|
async with pool.acquire() as conn:
|
|
103
111
|
async with conn.transaction():
|
|
104
112
|
try:
|
|
105
113
|
await conn.execute(
|
|
106
|
-
f"SELECT pglogical.replication_set_add_table('
|
|
114
|
+
f"SELECT pglogical.replication_set_add_table('pgbelt', '\"{table}\"');"
|
|
107
115
|
)
|
|
108
|
-
logger.debug(f"{table} added to
|
|
116
|
+
logger.debug(f"Table '{table}' added to 'pgbelt' replication set")
|
|
109
117
|
except UniqueViolationError:
|
|
110
|
-
logger.debug(f"{table} already in
|
|
118
|
+
logger.debug(f"Table '{table}' already in 'pgbelt' replication set")
|
|
111
119
|
|
|
112
120
|
|
|
113
121
|
async def configure_node(pool: Pool, name: str, dsn: str, logger: Logger) -> None:
|
|
@@ -145,6 +153,7 @@ async def configure_subscription(
|
|
|
145
153
|
await conn.execute(
|
|
146
154
|
f"""SELECT pglogical.create_subscription(
|
|
147
155
|
subscription_name:='{name}',
|
|
156
|
+
replication_sets:='{{pgbelt}}',
|
|
148
157
|
provider_dsn:='{provider_dsn}',
|
|
149
158
|
synchronize_structure:=false,
|
|
150
159
|
synchronize_data:={'true' if name.startswith('pg1') else 'false'},
|
|
@@ -197,8 +206,8 @@ async def teardown_replication_set(pool: Pool, logger: Logger) -> None:
|
|
|
197
206
|
async with pool.acquire() as conn:
|
|
198
207
|
async with conn.transaction():
|
|
199
208
|
try:
|
|
200
|
-
await conn.execute("SELECT pglogical.drop_replication_set('
|
|
201
|
-
logger.debug("Replication set '
|
|
209
|
+
await conn.execute("SELECT pglogical.drop_replication_set('pgbelt');")
|
|
210
|
+
logger.debug("Replication set 'pgbelt' dropped")
|
|
202
211
|
except (
|
|
203
212
|
InvalidSchemaNameError,
|
|
204
213
|
UndefinedFunctionError,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pgbelt
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: A CLI tool used to manage Postgres data migrations from beginning to end, for a single database or a fleet, leveraging pglogical replication.
|
|
5
5
|
Author: Varjitt Jeeva
|
|
6
6
|
Author-email: varjitt.jeeva@autodesk.com
|
|
@@ -18,10 +18,10 @@ pgbelt/util/__init__.py,sha256=-6KkvVMz-yGNQfeoo4CZZrgWKXYmFd4CMyoiao8OnFE,40
|
|
|
18
18
|
pgbelt/util/asyncfuncs.py,sha256=7i_GpBmUNNZ8RUGvU-q5nclsoaCm6Lx8jLP8usYvmZc,583
|
|
19
19
|
pgbelt/util/dump.py,sha256=p6M26s3FXnSCTmee4v7X0-azYvmcVz6DkZf8J8YxU0s,14357
|
|
20
20
|
pgbelt/util/logs.py,sha256=l2jT-WKZ-33eNDw4S4W1_eE4ISo4rtDRXYLVf4QTV4Y,1699
|
|
21
|
-
pgbelt/util/pglogical.py,sha256=
|
|
21
|
+
pgbelt/util/pglogical.py,sha256=URi4L_4PWYIz0iWw7HcXNfjzvWXPjQCm71cAOqnt3Qk,13059
|
|
22
22
|
pgbelt/util/postgres.py,sha256=9AgnmHdYpWVypyBNTEQEpd4COoa1JEQXoELOR8-HrzQ,13668
|
|
23
|
-
pgbelt-0.6.
|
|
24
|
-
pgbelt-0.6.
|
|
25
|
-
pgbelt-0.6.
|
|
26
|
-
pgbelt-0.6.
|
|
27
|
-
pgbelt-0.6.
|
|
23
|
+
pgbelt-0.6.2.dist-info/LICENSE,sha256=FQ5cFkW02dKK3LmKH8z-rwn93tWSCh7lsxfNUiWcFsg,10758
|
|
24
|
+
pgbelt-0.6.2.dist-info/METADATA,sha256=7bEElDGURHPEE3cVWbF19aPGhAXNQ0_YxPRpdZK_Fc8,2826
|
|
25
|
+
pgbelt-0.6.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
26
|
+
pgbelt-0.6.2.dist-info/entry_points.txt,sha256=SCz_poPjkaVnWpJ-CeytAnDzbVc6l0WalOwitIqW_3g,40
|
|
27
|
+
pgbelt-0.6.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|