altcodepro-polydb-python 2.2.9__py3-none-any.whl → 2.3.1__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.2.9
3
+ Version: 2.3.1
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
@@ -20,13 +20,14 @@ Classifier: Programming Language :: Python :: 3.10
20
20
  Classifier: Programming Language :: Python :: 3.11
21
21
  Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Operating System :: OS Independent
23
- Requires-Python: >=3.8
23
+ Requires-Python: >=3.11
24
24
  Description-Content-Type: text/markdown
25
25
  License-File: LICENSE
26
26
  Requires-Dist: psycopg2-binary>=2.9.11
27
27
  Requires-Dist: tenacity>=9.1.4
28
28
  Requires-Dist: redis>=6.4.0
29
29
  Requires-Dist: python-dotenv>=1.1.1
30
+ Requires-Dist: azure-storage-queue>=12.15.0
30
31
  Provides-Extra: aws
31
32
  Requires-Dist: boto3>=1.42.47; extra == "aws"
32
33
  Requires-Dist: botocore>=1.42.47; extra == "aws"
@@ -1,11 +1,11 @@
1
- altcodepro_polydb_python-2.2.9.dist-info/licenses/LICENSE,sha256=9X8GLocsBwy-5aR5JGOt2SAMDDPs9Qv-YnqmHBHOXrw,1067
1
+ altcodepro_polydb_python-2.3.1.dist-info/licenses/LICENSE,sha256=9X8GLocsBwy-5aR5JGOt2SAMDDPs9Qv-YnqmHBHOXrw,1067
2
2
  polydb/PolyDB.py,sha256=p9eDdvBGosE4fNSSAbtq3tHObdKZ-C2V2Q_ia39Ackk,23397
3
3
  polydb/__init__.py,sha256=UhUzfSvmMgKbV2tSME1ooIyfshIBi7_WyU4xl1tWWiA,1454
4
4
  polydb/advanced_query.py,sha256=cxMB-EB-qT3bWXJlhmjnMCUtrzogORWyoEfS50Dy7go,4280
5
5
  polydb/batch.py,sha256=_DjWZa1ZXYSk6MLKqFe0eT7SYVRZtYNqZb9bI8Y2sao,4566
6
6
  polydb/cache.py,sha256=JBXF1XEK-fY80ar8SDE893Z1Z116YtXAEG0PaJ0Nkcw,7658
7
7
  polydb/cloudDatabaseFactory.py,sha256=ISrgqe6oVejCkJMkIh1hnk0eVVDAUfbBXNRpGOfqVwA,18196
8
- polydb/databaseFactory.py,sha256=W55i2pId05OGTWYqTC_OhpEsYJG7bqHrDhZhf4grXhQ,39320
8
+ polydb/databaseFactory.py,sha256=TRZSsaAUJ-7RZcOiBkfGEfyUNnIsIpTarJ7imXpjRHw,39412
9
9
  polydb/decorators.py,sha256=Rzk8Bj8wHi8YFtc06HEYT5r_Vqqn7TGaCtR5qvHdY-E,420
10
10
  polydb/errors.py,sha256=rcFeBH0cenjJ86v0cmDc2Yjj4R019pLCBcTeSC4qps4,1428
11
11
  polydb/json_safe.py,sha256=R5PrqAGirqjYKPyy-8KH-lSXjLH0FPr2TSGozy4eheU,149
@@ -23,8 +23,8 @@ polydb/utils.py,sha256=G_ki5zKr5rGPgpFQM1CTq6twQd5OytaHKfet267MftM,1662
23
23
  polydb/validation.py,sha256=a1o1d02k3c6PWQwkBbw_0nEmIgrdB5RR8OcpNQMn4cA,4810
24
24
  polydb/adapters/AzureBlobStorageAdapter.py,sha256=iNscCIeoWy4YJo3IbI7gNam-NUT7t45ayrlPnYfqlCQ,6409
25
25
  polydb/adapters/AzureFileStorageAdapter.py,sha256=OuZY5P-FTQ36954obJN65oSMqmW3d-7QBmXxVGX0lds,6086
26
- polydb/adapters/AzureQueueAdapter.py,sha256=qOiQZi1O_Nm7HQ3khFeQFGzHMFfbdxxhWfWTynWBtMg,4698
27
- polydb/adapters/AzureTableStorageAdapter.py,sha256=dqbCCTxXsPvaOf-z9hJ0BfgE51DomyMJOdTN8tyyDsI,18498
26
+ polydb/adapters/AzureQueueAdapter.py,sha256=5tslwI0DgvMeb20w57aVSSSKiuCJEKrYjN0kGuFcdUI,5276
27
+ polydb/adapters/AzureTableStorageAdapter.py,sha256=_dU2inhIASHXxgsEkIG4kqE9vTUyqKyVKwCMQfyL5rk,18496
28
28
  polydb/adapters/BlockchainBlobAdapter.py,sha256=BXSDT6rDGGE04qM2-dVNAeWk-VcF82JGHAdUJeYHCbI,3320
29
29
  polydb/adapters/BlockchainKVAdapter.py,sha256=5Egic8QyulgYcy9O12iWKq2EDyVEvnXp_ereYgIvbHk,4546
30
30
  polydb/adapters/BlockchainQueueAdapter.py,sha256=K01klT8Eu8c-y1G9Sg2r0PIjay_at9x27kCTTEHPkNY,4179
@@ -52,7 +52,7 @@ polydb/base/ObjectStorageAdapter.py,sha256=mNdJnhoB3VqSCQvmcoel5PohrVQw7Nrajdd5s
52
52
  polydb/base/QueueAdapter.py,sha256=jFgyG-SUK4nhRNxm2NbzUbwnA9b_5iAC-ikLSUpXRwk,799
53
53
  polydb/base/SharedFilesAdapter.py,sha256=hvmdNNhNxpN46Ob9RLAi8l46GB6JolYyZWnAMuaJ86g,708
54
54
  polydb/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
- altcodepro_polydb_python-2.2.9.dist-info/METADATA,sha256=0Ash5m4KvNyJarw5uK5fY7kVJxkFsE6M8rIjd0di9iw,11865
56
- altcodepro_polydb_python-2.2.9.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
57
- altcodepro_polydb_python-2.2.9.dist-info/top_level.txt,sha256=WgLFWJoYjUhwvyPxJFl6jYLrVFuBJDX3OABf4ocwk_E,7
58
- altcodepro_polydb_python-2.2.9.dist-info/RECORD,,
55
+ altcodepro_polydb_python-2.3.1.dist-info/METADATA,sha256=kUXAnu2Aqq6iVb-Del5JWMrbPxo3OIX8bvewmF5wmEI,11910
56
+ altcodepro_polydb_python-2.3.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
57
+ altcodepro_polydb_python-2.3.1.dist-info/top_level.txt,sha256=WgLFWJoYjUhwvyPxJFl6jYLrVFuBJDX3OABf4ocwk_E,7
58
+ altcodepro_polydb_python-2.3.1.dist-info/RECORD,,
@@ -3,6 +3,8 @@
3
3
  import os
4
4
  import threading
5
5
  import json
6
+ import re
7
+
6
8
  from typing import Any, Dict, List, Optional
7
9
 
8
10
  from azure.storage.queue import QueueServiceClient, QueueClient
@@ -40,6 +42,12 @@ class AzureQueueAdapter(QueueAdapter):
40
42
 
41
43
  self._initialize_client()
42
44
 
45
+ def _normalize_queue_name(self, name: str) -> str:
46
+ name = name.lower()
47
+ name = re.sub(r"[^a-z0-9-]", "-", name) # replace invalid chars
48
+ name = re.sub(r"-+", "-", name) # collapse multiple dashes
49
+ return name.strip("-")
50
+
43
51
  def _initialize_client(self) -> None:
44
52
  """Initialize Azure Queue client"""
45
53
  try:
@@ -59,7 +67,7 @@ class AzureQueueAdapter(QueueAdapter):
59
67
  """Get or create queue client"""
60
68
  if self._client is None:
61
69
  raise ConnectionError("Azure Queue client not initialized")
62
-
70
+ queue_name = self._normalize_queue_name(queue_name)
63
71
  if queue_name not in self._queues:
64
72
  queue_client = self._client.get_queue_client(queue_name)
65
73
 
@@ -76,6 +84,7 @@ class AzureQueueAdapter(QueueAdapter):
76
84
  def send(self, message: Dict[str, Any], queue_name: str = "default") -> str:
77
85
  """Send message to queue"""
78
86
  try:
87
+ queue_name = self._normalize_queue_name(queue_name)
79
88
  queue_client = self._get_queue(queue_name)
80
89
 
81
90
  response = queue_client.send_message(json.dumps(message, default=json_safe))
@@ -89,6 +98,8 @@ class AzureQueueAdapter(QueueAdapter):
89
98
  def receive(self, queue_name: str = "default", max_messages: int = 1) -> List[Dict[str, Any]]:
90
99
  """Receive messages"""
91
100
  try:
101
+
102
+ queue_name = self._normalize_queue_name(queue_name)
92
103
  queue_client = self._get_queue(queue_name)
93
104
 
94
105
  messages = queue_client.receive_messages(max_messages=max_messages)
@@ -113,6 +124,7 @@ class AzureQueueAdapter(QueueAdapter):
113
124
  def delete(self, message_id: str, queue_name: str = "default", pop_receipt: str = "") -> bool:
114
125
  """Delete message from queue"""
115
126
  try:
127
+ queue_name = self._normalize_queue_name(queue_name)
116
128
  queue_client = self._get_queue(queue_name)
117
129
 
118
130
  queue_client.delete_message(message_id, pop_receipt)
@@ -144,7 +156,7 @@ class AzureQueueAdapter(QueueAdapter):
144
156
  """
145
157
  if not message_id:
146
158
  raise QueueError("AzureQueueAdapter.ack requires message_id")
147
-
159
+ queue_name = self._normalize_queue_name(queue_name)
148
160
  return self.delete(
149
161
  message_id=message_id,
150
162
  queue_name=queue_name,
@@ -40,7 +40,7 @@ class AzureTableStorageAdapter(NoSQLKVAdapter):
40
40
  - Always returns id (derived from RowKey if missing)
41
41
  """
42
42
 
43
- AZURE_TABLE_MAX_SIZE = 1024 * 1024 # 1MB
43
+ AZURE_TABLE_MAX_SIZE = 60 * 1024 # 1MB
44
44
  _RESERVED = {"PartitionKey", "RowKey", "Timestamp", "etag", "ETag"}
45
45
 
46
46
  def __init__(
polydb/databaseFactory.py CHANGED
@@ -145,6 +145,7 @@ class DatabaseFactory:
145
145
  # Multi-engine
146
146
  engines: Optional[List[EngineConfig]] = None,
147
147
  # Feature flags
148
+ redis_cache_url: Optional[str] = None,
148
149
  enable_retries: bool = True,
149
150
  enable_audit: bool = True,
150
151
  enable_audit_reads: bool = False,
@@ -168,7 +169,7 @@ class DatabaseFactory:
168
169
  self._cache: Optional[RedisCacheEngine] = None
169
170
  self.cache_warmer: Optional[CacheWarmer] = None
170
171
  if enable_cache and use_redis_cache:
171
- redis_url = os.getenv("REDIS_CACHE_URL")
172
+ redis_url = redis_cache_url or os.getenv("REDIS_CACHE_URL") or os.getenv("REDIS_URL")
172
173
  if redis_url:
173
174
  self._cache = RedisCacheEngine(redis_url=redis_url)
174
175
  self.cache_warmer = CacheWarmer(self, self._cache)