pgbelt 0.6.1__tar.gz → 0.6.2__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.6.1 → pgbelt-0.6.2}/PKG-INFO +1 -1
  2. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/util/pglogical.py +15 -6
  3. {pgbelt-0.6.1 → pgbelt-0.6.2}/pyproject.toml +4 -4
  4. {pgbelt-0.6.1 → pgbelt-0.6.2}/LICENSE +0 -0
  5. {pgbelt-0.6.1 → pgbelt-0.6.2}/README.md +0 -0
  6. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/__init__.py +0 -0
  7. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/cmd/__init__.py +0 -0
  8. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/cmd/convenience.py +0 -0
  9. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/cmd/helpers.py +0 -0
  10. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/cmd/login.py +0 -0
  11. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/cmd/preflight.py +0 -0
  12. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/cmd/schema.py +0 -0
  13. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/cmd/setup.py +0 -0
  14. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/cmd/status.py +0 -0
  15. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/cmd/sync.py +0 -0
  16. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/cmd/teardown.py +0 -0
  17. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/config/__init__.py +0 -0
  18. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/config/config.py +0 -0
  19. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/config/models.py +0 -0
  20. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/config/remote.py +0 -0
  21. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/main.py +0 -0
  22. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/util/__init__.py +0 -0
  23. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/util/asyncfuncs.py +0 -0
  24. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/util/dump.py +0 -0
  25. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/util/logs.py +0 -0
  26. {pgbelt-0.6.1 → pgbelt-0.6.2}/pgbelt/util/postgres.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pgbelt
3
- Version: 0.6.1
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
@@ -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(f"Configuring default replication set with tables: {tables}")
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('default', '\"{table}\"');"
114
+ f"SELECT pglogical.replication_set_add_table('pgbelt', '\"{table}\"');"
107
115
  )
108
- logger.debug(f"{table} added to default replication set")
116
+ logger.debug(f"Table '{table}' added to 'pgbelt' replication set")
109
117
  except UniqueViolationError:
110
- logger.debug(f"{table} already in default replication set")
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('default');")
201
- logger.debug("Replication set 'default' dropped")
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
  [tool.poetry]
2
2
  name = "pgbelt"
3
- version = "0.6.1"
3
+ version = "0.6.2"
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,7 +18,7 @@ tabulate = "^0.9.0"
18
18
  typer = "^0.9.0"
19
19
 
20
20
  [tool.poetry.dev-dependencies]
21
- black = "~23.12.1"
21
+ black = "~24.1.1"
22
22
  pre-commit = "~3.6.0"
23
23
  flake8 = "^7.0.0"
24
24
  pytest-cov = "~4.1.0"
@@ -26,7 +26,7 @@ pytest = "^7.4.4"
26
26
  coverage = {extras = ["toml"], version = "^7.4"}
27
27
  safety = "^2.3.1"
28
28
  mypy = "^1.8"
29
- xdoctest = {extras = ["colors"], version = "^1.1.2"}
29
+ xdoctest = {extras = ["colors"], version = "^1.1.3"}
30
30
  flake8-bandit = "~4.1.1"
31
31
  flake8-bugbear = ">=21.9.2"
32
32
  flake8-docstrings = "^1.6.0"
@@ -38,7 +38,7 @@ pre-commit-hooks = "^4.5.0"
38
38
  Pygments = "^2.17.2"
39
39
  pyupgrade = "^3.15.0"
40
40
  pylint = "^3.0.3"
41
- pytest-asyncio = "~0.23.3"
41
+ pytest-asyncio = "~0.23.4"
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
File without changes
File without changes
File without changes