wcp-library 1.5.3__py3-none-any.whl → 1.5.7__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.
wcp_library/sql/__init__.py
CHANGED
@@ -24,15 +24,17 @@ def retry(f: callable) -> callable:
|
|
24
24
|
try:
|
25
25
|
return f(self, *args, **kwargs)
|
26
26
|
except (oracledb.OperationalError, oracledb.DatabaseError, psycopg.OperationalError) as e:
|
27
|
-
|
28
|
-
|
29
|
-
self._retry_count
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
if isinstance(e, (oracledb.OperationalError, oracledb.DatabaseError, psycopg.OperationalError, psycopg.DatabaseError)):
|
28
|
+
error_obj, = e.args
|
29
|
+
if error_obj.full_code in self.retry_error_codes and self._retry_count < self.retry_limit:
|
30
|
+
self._retry_count += 1
|
31
|
+
logger.debug("Oracle connection error")
|
32
|
+
logger.debug(error_obj.message)
|
33
|
+
logger.info("Waiting 5 minutes before retrying Oracle connection")
|
34
|
+
sleep(300)
|
35
|
+
else:
|
36
|
+
raise e
|
37
|
+
raise e
|
36
38
|
return wrapper
|
37
39
|
|
38
40
|
|
@@ -51,13 +53,16 @@ def async_retry(f: callable) -> callable:
|
|
51
53
|
try:
|
52
54
|
return await f(self, *args, **kwargs)
|
53
55
|
except (oracledb.OperationalError, oracledb.DatabaseError, psycopg.OperationalError) as e:
|
54
|
-
|
55
|
-
|
56
|
-
self._retry_count
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
56
|
+
if isinstance(e, (oracledb.OperationalError, oracledb.DatabaseError, psycopg.OperationalError, psycopg.DatabaseError)):
|
57
|
+
error_obj, = e.args
|
58
|
+
if error_obj.full_code in self.retry_error_codes and self._retry_count < self.retry_limit:
|
59
|
+
self._retry_count += 1
|
60
|
+
logger.debug(f"{self._db_service} connection error")
|
61
|
+
logger.debug(error_obj.message)
|
62
|
+
logger.info("Waiting 5 minutes before retrying Oracle connection")
|
63
|
+
await asyncio.sleep(300)
|
64
|
+
else:
|
65
|
+
raise e
|
61
66
|
else:
|
62
67
|
raise e
|
63
68
|
return wrapper
|
wcp_library/sql/postgres.py
CHANGED
@@ -34,6 +34,7 @@ def _connect_warehouse(username: str, password: str, hostname: str, port: int, d
|
|
34
34
|
conninfo=conninfo,
|
35
35
|
min_size=min_connections,
|
36
36
|
max_size=max_connections,
|
37
|
+
kwargs={'options': '-c datestyle=ISO,YMD'},
|
37
38
|
open=True
|
38
39
|
)
|
39
40
|
return session_pool
|
@@ -60,7 +61,9 @@ async def _async_connect_warehouse(username: str, password: str, hostname: str,
|
|
60
61
|
session_pool = AsyncConnectionPool(
|
61
62
|
conninfo=conninfo,
|
62
63
|
min_size=min_connections,
|
63
|
-
max_size=max_connections
|
64
|
+
max_size=max_connections,
|
65
|
+
kwargs={"options": "-c datestyle=ISO,YMD"},
|
66
|
+
open=False
|
64
67
|
)
|
65
68
|
return session_pool
|
66
69
|
|
@@ -16,10 +16,10 @@ wcp_library/logging.py,sha256=e6gG7HFgUrMajUZs4Gs0atFfOJJmdmxN0GerfynNWlY,2061
|
|
16
16
|
wcp_library/selenium/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
17
|
wcp_library/selenium/_selenium_driver.py,sha256=Es83ISNryOVhYGDo_xrr8nCLsbnVBeXsaz1sRiz7kLI,2961
|
18
18
|
wcp_library/selenium/selenium_helper.py,sha256=OJvC0RlblfMWhmjNxiY582yuzkDgjzFZMuRz_8to3PY,2000
|
19
|
-
wcp_library/sql/__init__.py,sha256=
|
19
|
+
wcp_library/sql/__init__.py,sha256=y8piBAFI-fkERf7EFND9_QW9h07x611Ts34oCw8SxWk,2398
|
20
20
|
wcp_library/sql/oracle.py,sha256=jcGoH2iGkgxW-RJV5FRf_CwNzilkxPN6_pJ27te5Qe0,15815
|
21
|
-
wcp_library/sql/postgres.py,sha256=
|
21
|
+
wcp_library/sql/postgres.py,sha256=lPcsmX0ejEgCRmNKWL9Wp_7R8sop5_KcWmpLieTGT1I,14938
|
22
22
|
wcp_library/time.py,sha256=ktSzhK7SZnGPNXobFexnhFGQAcriLCJQKxnO0fed8fQ,1740
|
23
|
-
wcp_library-1.5.
|
24
|
-
wcp_library-1.5.
|
25
|
-
wcp_library-1.5.
|
23
|
+
wcp_library-1.5.7.dist-info/METADATA,sha256=PI070ZPfRL_G02UHH2nJu2Nd5wA_RbOb3_szlGZF940,1393
|
24
|
+
wcp_library-1.5.7.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
25
|
+
wcp_library-1.5.7.dist-info/RECORD,,
|
File without changes
|