altcodepro-polydb-python 2.3.25__py3-none-any.whl → 2.3.26__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: altcodepro-polydb-python
3
- Version: 2.3.25
3
+ Version: 2.3.26
4
4
  Summary: Production-ready multi-cloud database abstraction layer with connection pooling, retry logic, and thread safety
5
5
  Author: AltCodePro
6
6
  Project-URL: Homepage, https://github.com/altcodepro/polydb-python
@@ -1,4 +1,4 @@
1
- altcodepro_polydb_python-2.3.25.dist-info/licenses/LICENSE,sha256=9X8GLocsBwy-5aR5JGOt2SAMDDPs9Qv-YnqmHBHOXrw,1067
1
+ altcodepro_polydb_python-2.3.26.dist-info/licenses/LICENSE,sha256=9X8GLocsBwy-5aR5JGOt2SAMDDPs9Qv-YnqmHBHOXrw,1067
2
2
  polydb/PolyDB.py,sha256=MG7-nV59zDvrUQwXNEgV4eetHCeW9TYY9DQqtxu_r7k,23543
3
3
  polydb/__init__.py,sha256=d9KSz888A336904TPEjWPYBtyJLPB0lTdcaOnYp8byY,1535
4
4
  polydb/advanced_query.py,sha256=cxMB-EB-qT3bWXJlhmjnMCUtrzogORWyoEfS50Dy7go,4280
@@ -19,7 +19,7 @@ polydb/retry.py,sha256=OfmNglrmL6AQlJPmXNdy9A9lRkH0P-vZ5BUuMiUM__4,3795
19
19
  polydb/schema.py,sha256=VrOayX6V6AD2Qh3-lm4ZVPTpI24e4V52IYheZf2rNQ4,5812
20
20
  polydb/security.py,sha256=9ju-hc6Y1sxobCoV_mZ3ZWroUD73LodyTLVMhY_HeKU,16360
21
21
  polydb/types.py,sha256=XB_85Un8_aWt4dSfpjIGotHbK3KBY2WurQGXr9EOxWY,2992
22
- polydb/utils.py,sha256=G_ki5zKr5rGPgpFQM1CTq6twQd5OytaHKfet267MftM,1662
22
+ polydb/utils.py,sha256=tS_KI1vt-VZ6JftbFxbnVxC0xpie1-zYikTGf1nSoFw,3183
23
23
  polydb/validation.py,sha256=a1o1d02k3c6PWQwkBbw_0nEmIgrdB5RR8OcpNQMn4cA,4810
24
24
  polydb/adapters/AzureBlobStorageAdapter.py,sha256=4vD55Z8DBTzBK66jIJbo5bNMY-AQ61MlP0-P2Fv_JgQ,7083
25
25
  polydb/adapters/AzureFileStorageAdapter.py,sha256=VZNprqlBXCuWUgtqClNT-NrQmRf-XFYEiRA2BLbf-Sc,7046
@@ -60,7 +60,7 @@ polydb/observability/logging.py,sha256=gv1SshNjaSkmR98Uv7Qbwq3gkeQUzVCA4ichqHKL6
60
60
  polydb/services/__init__.py,sha256=nMolMXzmhejRSm7f42kU9fCHF0GIpqpejN2kywuBsUQ,241
61
61
  polydb/services/compliance_service.py,sha256=-0ncX7PrXy4-NuyWXIv65cLUsqz0jXzb3LtsD8rlrXE,4983
62
62
  polydb/services/security_service.py,sha256=q7GzK6sbMnBBsc4fuL4oXTd-ui2b-MYQyrWTBvdVNSk,5062
63
- altcodepro_polydb_python-2.3.25.dist-info/METADATA,sha256=jKo3HkAeo__dmf5vAvRukWvNcqqe1tIscypWPzcju3M,12359
64
- altcodepro_polydb_python-2.3.25.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
65
- altcodepro_polydb_python-2.3.25.dist-info/top_level.txt,sha256=WgLFWJoYjUhwvyPxJFl6jYLrVFuBJDX3OABf4ocwk_E,7
66
- altcodepro_polydb_python-2.3.25.dist-info/RECORD,,
63
+ altcodepro_polydb_python-2.3.26.dist-info/METADATA,sha256=D5suhSTtKr4f65k7_le2erc4HEM1xXvAF0eh7wn8FFY,12359
64
+ altcodepro_polydb_python-2.3.26.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
65
+ altcodepro_polydb_python-2.3.26.dist-info/top_level.txt,sha256=WgLFWJoYjUhwvyPxJFl6jYLrVFuBJDX3OABf4ocwk_E,7
66
+ altcodepro_polydb_python-2.3.26.dist-info/RECORD,,
polydb/utils.py CHANGED
@@ -3,11 +3,16 @@
3
3
  Utility functions for validation and logging
4
4
  """
5
5
 
6
+ import os
6
7
  import re
7
8
  import logging
8
9
  from typing import Dict, Any
9
10
  from .errors import ValidationError
10
11
 
12
+ # Loggers already configured by setup_logger(), so per-request adapter
13
+ # construction doesn't reconfigure (and re-clobber) them repeatedly.
14
+ _configured_loggers: set[str] = set()
15
+
11
16
 
12
17
  def validate_table_name(table: str) -> str:
13
18
  """
@@ -43,19 +48,47 @@ def validate_columns(data: Dict[str, Any]) -> Dict[str, Any]:
43
48
 
44
49
 
45
50
  def setup_logger(name: str, level: int = logging.INFO) -> logging.Logger:
46
- """Setup logger with consistent format"""
51
+ """Return a logger, configuring it at most once.
52
+
53
+ Adapters are constructed per request, so running the full setup on every
54
+ call would (a) reset a level the embedding app deliberately set and (b)
55
+ re-attach a duplicate plain-text handler — which is why "Initialized Azure
56
+ Queue Storage client" spammed on every request in both plain and JSON form.
57
+
58
+ Behaviour:
59
+ * Idempotent — a given logger name is configured only once.
60
+ * Host-managed root — when the embedding app owns root logging (it sets the
61
+ ``ALTCODEPRO_ROOT_LOGGING_MANAGED`` sentinel), polydb attaches NO handler
62
+ of its own and does NOT force a level. Records propagate to the host's
63
+ formatter and honour whatever level the host pinned (so the host can
64
+ quiet noisy adapters). This is the standard "library shouldn't seize
65
+ logging" contract.
66
+ * Standalone — with no host managing root, keep the original behaviour:
67
+ set the level and install a plain StreamHandler.
68
+ """
47
69
  logger = logging.getLogger(name)
48
- logger.setLevel(level)
49
-
70
+ if name in _configured_loggers:
71
+ return logger
72
+ _configured_loggers.add(name)
73
+
74
+ host_managed = bool(os.getenv("ALTCODEPRO_ROOT_LOGGING_MANAGED"))
75
+ if host_managed:
76
+ # Let the host own formatting and level; just propagate.
77
+ return logger
78
+
79
+ # Respect a level the caller already pinned explicitly on this logger.
80
+ if logger.level == logging.NOTSET:
81
+ logger.setLevel(level)
82
+
50
83
  # Clear existing handlers to avoid duplication in multiprocess scenarios
51
- if logger.hasHandlers():
84
+ if logger.handlers:
52
85
  logger.handlers.clear()
53
-
86
+
54
87
  handler = logging.StreamHandler()
55
88
  formatter = logging.Formatter(
56
89
  '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
57
90
  )
58
91
  handler.setFormatter(formatter)
59
92
  logger.addHandler(handler)
60
-
93
+
61
94
  return logger