pgbelt 0.5.4__tar.gz → 0.6.1__tar.gz

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.
Files changed (26) hide show
  1. {pgbelt-0.5.4 → pgbelt-0.6.1}/PKG-INFO +2 -1
  2. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/cmd/teardown.py +4 -5
  3. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/config/remote.py +3 -1
  4. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/util/pglogical.py +11 -16
  5. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/util/postgres.py +0 -1
  6. {pgbelt-0.5.4 → pgbelt-0.6.1}/pyproject.toml +10 -10
  7. {pgbelt-0.5.4 → pgbelt-0.6.1}/LICENSE +0 -0
  8. {pgbelt-0.5.4 → pgbelt-0.6.1}/README.md +0 -0
  9. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/__init__.py +0 -0
  10. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/cmd/__init__.py +0 -0
  11. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/cmd/convenience.py +0 -0
  12. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/cmd/helpers.py +0 -0
  13. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/cmd/login.py +0 -0
  14. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/cmd/preflight.py +0 -0
  15. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/cmd/schema.py +0 -0
  16. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/cmd/setup.py +0 -0
  17. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/cmd/status.py +0 -0
  18. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/cmd/sync.py +0 -0
  19. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/config/__init__.py +0 -0
  20. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/config/config.py +0 -0
  21. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/config/models.py +0 -0
  22. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/main.py +0 -0
  23. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/util/__init__.py +0 -0
  24. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/util/asyncfuncs.py +0 -0
  25. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/util/dump.py +0 -0
  26. {pgbelt-0.5.4 → pgbelt-0.6.1}/pgbelt/util/logs.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pgbelt
3
- Version: 0.5.4
3
+ Version: 0.6.1
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
@@ -9,6 +9,7 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.9
10
10
  Classifier: Programming Language :: Python :: 3.10
11
11
  Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
12
13
  Requires-Dist: aiofiles (>=0.8,<23.3)
13
14
  Requires-Dist: asyncpg (>=0.27,<0.30)
14
15
  Requires-Dist: pydantic (>=2.0,<3.0)
@@ -79,15 +79,14 @@ async def teardown(
79
79
  teardown_node(src_root_pool, "pg1", src_logger),
80
80
  teardown_node(dst_root_pool, "pg2", dst_logger),
81
81
  )
82
+ await gather(
83
+ revoke_pgl(src_root_pool, conf.tables, src_logger),
84
+ revoke_pgl(dst_root_pool, conf.tables, dst_logger),
85
+ )
82
86
 
83
87
  if full:
84
88
  await sleep(15)
85
89
 
86
- await gather(
87
- revoke_pgl(src_root_pool, conf.tables, src_logger),
88
- revoke_pgl(dst_root_pool, conf.tables, dst_logger),
89
- )
90
-
91
90
  await gather(
92
91
  teardown_pgl(src_root_pool, src_logger),
93
92
  teardown_pgl(dst_root_pool, dst_logger),
@@ -154,7 +154,9 @@ async def resolve_remote_config(
154
154
  )
155
155
  return None
156
156
  except RemoteConfigError as e:
157
- logger.error(f"Failed to resolve remote configuration for {db} {dc}. RemoteConfigError {e}")
157
+ logger.error(
158
+ f"Failed to resolve remote configuration for {db} {dc}. RemoteConfigError {e}"
159
+ )
158
160
  return None
159
161
  except ValidationError:
160
162
  logger.error(
@@ -209,20 +209,15 @@ async def teardown_replication_set(pool: Pool, logger: Logger) -> None:
209
209
 
210
210
  async def revoke_pgl(pool: Pool, tables: list[str], logger: Logger) -> None:
211
211
  """
212
- Revoke data access permissions from pglogical
212
+ Revoke data access permissions from pglogical, and drop the pglogical role
213
213
  """
214
214
  logger.info("Revoking data access permissions from pglogical...")
215
215
  async with pool.acquire() as conn:
216
216
  async with conn.transaction():
217
217
  try:
218
- if tables:
219
- await conn.execute(
220
- f"REVOKE ALL ON TABLE {','.join(tables)} FROM pglogical;"
221
- )
222
- else:
223
- await conn.execute(
224
- "REVOKE ALL ON ALL TABLES IN SCHEMA public FROM pglogical;"
225
- )
218
+ await conn.execute(
219
+ "REVOKE ALL ON ALL TABLES IN SCHEMA public FROM pglogical;"
220
+ )
226
221
  await conn.execute(
227
222
  "REVOKE ALL ON ALL SEQUENCES IN SCHEMA public FROM pglogical;"
228
223
  )
@@ -233,10 +228,16 @@ async def revoke_pgl(pool: Pool, tables: list[str], logger: Logger) -> None:
233
228
  else:
234
229
  raise e
235
230
 
231
+ logger.info("Dropping pglogical role...")
232
+ async with pool.acquire() as conn:
233
+ async with conn.transaction():
234
+ await conn.execute("DROP ROLE IF EXISTS pglogical;")
235
+ logger.debug("Pglogical role dropped")
236
+
236
237
 
237
238
  async def teardown_pgl(pool: Pool, logger: Logger) -> None:
238
239
  """
239
- If they exist, drop the pglogical extension and then the user
240
+ If they exist, drop the pglogical extension
240
241
  """
241
242
  logger.info("Dropping pglogical extension...")
242
243
  async with pool.acquire() as conn:
@@ -244,12 +245,6 @@ async def teardown_pgl(pool: Pool, logger: Logger) -> None:
244
245
  await conn.execute("DROP EXTENSION IF EXISTS pglogical;")
245
246
  logger.debug("Pglogical extension dropped")
246
247
 
247
- logger.info("Dropping pglogical user...")
248
- async with pool.acquire() as conn:
249
- async with conn.transaction():
250
- await conn.execute("DROP ROLE IF EXISTS pglogical;")
251
- logger.debug("Pglogical user dropped")
252
-
253
248
 
254
249
  async def subscription_status(pool: Pool, logger: Logger) -> str:
255
250
  """
@@ -74,7 +74,6 @@ async def compare_data(
74
74
  await dst_pool.execute("SET extra_float_digits TO 0;")
75
75
 
76
76
  for table in set(pkeys):
77
-
78
77
  # If specific table list is defined and iterated table is not in that list, skip.
79
78
  if tables and (table not in tables):
80
79
  continue
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pgbelt"
3
- version = "0.5.4"
3
+ version = "0.6.1"
4
4
  description = "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
  authors = ["Varjitt Jeeva <varjitt.jeeva@autodesk.com>"]
6
6
  readme = "README.md"
@@ -18,14 +18,14 @@ tabulate = "^0.9.0"
18
18
  typer = "^0.9.0"
19
19
 
20
20
  [tool.poetry.dev-dependencies]
21
- black = "~23.11.0"
22
- pre-commit = "~3.5.0"
23
- flake8 = "^6.0.0"
21
+ black = "~23.12.1"
22
+ pre-commit = "~3.6.0"
23
+ flake8 = "^7.0.0"
24
24
  pytest-cov = "~4.1.0"
25
- pytest = "^7.4.3"
26
- coverage = {extras = ["toml"], version = "^7.2"}
25
+ pytest = "^7.4.4"
26
+ coverage = {extras = ["toml"], version = "^7.4"}
27
27
  safety = "^2.3.1"
28
- mypy = "^1.6"
28
+ mypy = "^1.8"
29
29
  xdoctest = {extras = ["colors"], version = "^1.1.2"}
30
30
  flake8-bandit = "~4.1.1"
31
31
  flake8-bugbear = ">=21.9.2"
@@ -35,10 +35,10 @@ pep8-naming = "^0.13.2"
35
35
  darglint = "^1.8.1"
36
36
  reorder-python-imports = "^3.9.0"
37
37
  pre-commit-hooks = "^4.5.0"
38
- Pygments = "^2.13.0"
38
+ Pygments = "^2.17.2"
39
39
  pyupgrade = "^3.15.0"
40
- pylint = "^3.0.2"
41
- pytest-asyncio = "~0.21.0"
40
+ pylint = "^3.0.3"
41
+ pytest-asyncio = "~0.23.3"
42
42
 
43
43
  [build-system]
44
44
  requires = ["poetry-core>=1.0.0", "setuptools"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes