pgbelt 0.7.0__tar.gz → 0.7.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.
- {pgbelt-0.7.0 → pgbelt-0.7.1}/PKG-INFO +1 -1
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/cmd/sync.py +1 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/util/pglogical.py +2 -1
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/util/postgres.py +29 -11
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pyproject.toml +1 -1
- {pgbelt-0.7.0 → pgbelt-0.7.1}/LICENSE +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/README.md +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/__init__.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/cmd/__init__.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/cmd/convenience.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/cmd/helpers.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/cmd/login.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/cmd/preflight.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/cmd/schema.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/cmd/setup.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/cmd/status.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/cmd/teardown.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/config/__init__.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/config/config.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/config/models.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/config/remote.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/main.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/util/__init__.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/util/asyncfuncs.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/util/dump.py +0 -0
- {pgbelt-0.7.0 → pgbelt-0.7.1}/pgbelt/util/logs.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pgbelt
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.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
|
|
@@ -78,8 +78,9 @@ async def grant_pgl(pool: Pool, tables: list[str], schema: str, logger: Logger)
|
|
|
78
78
|
async with pool.acquire() as conn:
|
|
79
79
|
async with conn.transaction():
|
|
80
80
|
if tables:
|
|
81
|
+
tables_with_schema = [f"{schema}.{table}" for table in tables]
|
|
81
82
|
await conn.execute(
|
|
82
|
-
f"GRANT ALL ON TABLE {','.join(
|
|
83
|
+
f"GRANT ALL ON TABLE {','.join(tables_with_schema)} TO pglogical;"
|
|
83
84
|
)
|
|
84
85
|
else:
|
|
85
86
|
await conn.execute(
|
|
@@ -12,20 +12,38 @@ async def dump_sequences(
|
|
|
12
12
|
return a dictionary of sequence names mapped to their last values
|
|
13
13
|
"""
|
|
14
14
|
logger.info("Dumping sequence values...")
|
|
15
|
-
|
|
15
|
+
# Get all sequences in the schema
|
|
16
|
+
seqs = await pool.fetch(
|
|
17
|
+
f"""
|
|
18
|
+
SELECT '{schema}' || '.' || sequence_name
|
|
19
|
+
FROM information_schema.sequences
|
|
20
|
+
WHERE sequence_schema = '{schema}';
|
|
21
|
+
"""
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# Note: When in an exodus migration with a non-public schema, the sequence names must be prefixed with the schema name.
|
|
25
|
+
# This may not be done by the user, so we must do it here.
|
|
26
|
+
proper_sequence_names = None
|
|
27
|
+
if targeted_sequences is not None:
|
|
28
|
+
proper_sequence_names = []
|
|
29
|
+
for seq in targeted_sequences:
|
|
30
|
+
if f"{schema}." not in seq:
|
|
31
|
+
proper_sequence_names.append(f"{schema}.{seq}")
|
|
32
|
+
else:
|
|
33
|
+
proper_sequence_names.append(seq)
|
|
34
|
+
targeted_sequences = proper_sequence_names
|
|
16
35
|
|
|
17
36
|
seq_vals = {}
|
|
37
|
+
final_seqs = []
|
|
38
|
+
# If we get a list of targeted sequences, we only want to dump whichever of those are found in the database and schema.
|
|
18
39
|
if targeted_sequences:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
seq_vals[f"{schema}.{seq_stripped}"] = await pool.fetchval(
|
|
27
|
-
f"SELECT last_value FROM {schema}.{seq};"
|
|
28
|
-
)
|
|
40
|
+
final_seqs = [r[0] for r in seqs if r[0] in targeted_sequences]
|
|
41
|
+
else: # Otherwise, we want to dump all sequences found in the schema.
|
|
42
|
+
final_seqs = [r[0] for r in seqs]
|
|
43
|
+
|
|
44
|
+
for seq in final_seqs:
|
|
45
|
+
res = await pool.fetchval(f"SELECT last_value FROM {seq};")
|
|
46
|
+
seq_vals[seq.strip()] = res
|
|
29
47
|
|
|
30
48
|
logger.debug(f"Dumped sequences: {seq_vals}")
|
|
31
49
|
return seq_vals
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pgbelt"
|
|
3
|
-
version = "0.7.
|
|
3
|
+
version = "0.7.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"
|
|
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
|