pgbelt 0.8.2__tar.gz → 0.8.3__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.8.2 → pgbelt-0.8.3}/PKG-INFO +2 -2
  2. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/util/logs.py +17 -6
  3. {pgbelt-0.8.2 → pgbelt-0.8.3}/pyproject.toml +6 -6
  4. {pgbelt-0.8.2 → pgbelt-0.8.3}/LICENSE +0 -0
  5. {pgbelt-0.8.2 → pgbelt-0.8.3}/README.md +0 -0
  6. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/__init__.py +0 -0
  7. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/cmd/__init__.py +0 -0
  8. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/cmd/convenience.py +0 -0
  9. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/cmd/helpers.py +0 -0
  10. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/cmd/login.py +0 -0
  11. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/cmd/preflight.py +0 -0
  12. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/cmd/schema.py +0 -0
  13. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/cmd/setup.py +0 -0
  14. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/cmd/status.py +0 -0
  15. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/cmd/sync.py +0 -0
  16. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/cmd/teardown.py +0 -0
  17. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/config/__init__.py +0 -0
  18. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/config/config.py +0 -0
  19. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/config/models.py +0 -0
  20. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/config/remote.py +0 -0
  21. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/main.py +0 -0
  22. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/util/__init__.py +0 -0
  23. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/util/asyncfuncs.py +0 -0
  24. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/util/dump.py +0 -0
  25. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/util/pglogical.py +0 -0
  26. {pgbelt-0.8.2 → pgbelt-0.8.3}/pgbelt/util/postgres.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: pgbelt
3
- Version: 0.8.2
3
+ Version: 0.8.3
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
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ from datetime import datetime
2
3
  from os import getenv
3
4
  from os import makedirs
4
5
 
@@ -8,7 +9,7 @@ FORMATTER = "{asctime} {name}:{levelname} {message}"
8
9
  # if this module is ever imported we set up the root logger to log to stderr
9
10
  root_level = int(getenv("LOG_LEVEL", logging.DEBUG))
10
11
  root_handler = logging.StreamHandler()
11
- formatter = logging.Formatter(fmt=FORMATTER, datefmt='%Y-%m-%d %H:%M:%S', style='{')
12
+ formatter = logging.Formatter(fmt=FORMATTER, datefmt="%Y-%m-%d %H:%M:%S", style="{")
12
13
  root_handler.setFormatter(formatter)
13
14
  root_handler.setLevel(root_level)
14
15
  root_logger = logging.getLogger("dbup")
@@ -20,13 +21,21 @@ def log_file_dir(db: str, dc: str) -> str:
20
21
  return f"logs/{db}/{dc}"
21
22
 
22
23
 
23
- def log_file_path(db: str, dc: str) -> str:
24
- return f"logs/{db}/{dc}/logs.txt"
24
+ def log_file_path(db: str, dc: str, kind: str) -> str:
25
+ timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
26
+ if kind:
27
+ return f"logs/{db}/{dc}/{timestamp}-{kind}.txt"
28
+ else:
29
+ return f"logs/{db}/{dc}/{timestamp}.txt"
25
30
 
26
31
 
27
32
  def get_logger(db: str, dc: str, kind: str = "") -> logging.Logger:
28
33
  # When we set up a logger for that db that emits to a file
29
- logger = logging.getLogger(f"dbup.{db}.{dc}")
34
+ logger = (
35
+ logging.getLogger(f"dbup.{db}.{dc}.{kind}")
36
+ if kind
37
+ else logging.getLogger(f"dbup.{db}.{dc}")
38
+ )
30
39
  if not logger.handlers:
31
40
  skip_file_handler = False
32
41
 
@@ -41,8 +50,10 @@ def get_logger(db: str, dc: str, kind: str = "") -> logging.Logger:
41
50
  pass
42
51
 
43
52
  if not skip_file_handler:
44
- handler = logging.FileHandler(log_file_path(db, dc), mode="w")
45
- handler.setFormatter(logging.Formatter(FORMATTER, datefmt='%Y-%m-%d %H:%M:%S', style="{"))
53
+ handler = logging.FileHandler(log_file_path(db, dc, kind), mode="w")
54
+ handler.setFormatter(
55
+ logging.Formatter(FORMATTER, datefmt="%Y-%m-%d %H:%M:%S", style="{")
56
+ )
46
57
  # always log everything to the file
47
58
  logger.setLevel(logging.DEBUG)
48
59
  logger.addHandler(handler)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pgbelt"
3
- version = "0.8.2"
3
+ version = "0.8.3"
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,8 +18,8 @@ tabulate = "^0.9.0"
18
18
  typer = ">=0.9,<0.16"
19
19
 
20
20
  [tool.poetry.dev-dependencies]
21
- black = "~24.10.0"
22
- pre-commit = "~4.0.1"
21
+ black = "~25.1.0"
22
+ pre-commit = "~4.1.0"
23
23
  flake8 = "^7.1.1"
24
24
  pytest-cov = "~6.0.0"
25
25
  pytest = "^8.3.4"
@@ -35,10 +35,10 @@ pep8-naming = "^0.14.1"
35
35
  darglint = "^1.8.1"
36
36
  reorder-python-imports = "^3.14.0"
37
37
  pre-commit-hooks = "^5.0.0"
38
- Pygments = "^2.18.0"
38
+ Pygments = "^2.19.1"
39
39
  pyupgrade = "^3.19.1"
40
- pylint = "^3.3.3"
41
- pytest-asyncio = "~0.25.1"
40
+ pylint = "^3.3.4"
41
+ pytest-asyncio = "~0.25.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
File without changes
File without changes
File without changes