wcp-library 1.0.7__py3-none-any.whl → 1.1.0__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.
@@ -112,11 +112,10 @@ class AsyncOracleConnection(object):
112
112
  :return: None
113
113
  """
114
114
 
115
- connection = self._session_pool.acquire()
116
- cursor = connection.cursor()
117
- await cursor.execute(query)
118
- await connection.commit()
119
- await self._session_pool.release(connection)
115
+ async with self._session_pool.acquire() as connection:
116
+ with connection.cursor() as cursor:
117
+ await cursor.execute(query)
118
+ await connection.commit()
120
119
 
121
120
  @retry
122
121
  async def safe_execute(self, query: str, packed_values: dict) -> None:
@@ -128,11 +127,10 @@ class AsyncOracleConnection(object):
128
127
  :return: None
129
128
  """
130
129
 
131
- connection = self._session_pool.acquire()
132
- cursor = connection.cursor()
133
- await cursor.execute(query, packed_values)
134
- await connection.commit()
135
- await self._session_pool.release(connection)
130
+ async with self._session_pool.acquire() as connection:
131
+ with connection.cursor() as cursor:
132
+ await cursor.execute(query, packed_values)
133
+ await connection.commit()
136
134
 
137
135
  @retry
138
136
  async def execute_multiple(self, queries: list[list[str, dict]]) -> None:
@@ -143,17 +141,16 @@ class AsyncOracleConnection(object):
143
141
  :return: None
144
142
  """
145
143
 
146
- connection = self._session_pool.acquire()
147
- cursor = connection.cursor()
148
- for item in queries:
149
- query = item[0]
150
- packed_values = item[1]
151
- if packed_values:
152
- await cursor.execute(query, packed_values)
153
- else:
154
- await cursor.execute(query)
155
- await connection.commit()
156
- await self._session_pool.release(connection)
144
+ async with self._session_pool.acquire() as connection:
145
+ with connection.cursor() as cursor:
146
+ for item in queries:
147
+ query = item[0]
148
+ packed_values = item[1]
149
+ if packed_values:
150
+ await cursor.execute(query, packed_values)
151
+ else:
152
+ await cursor.execute(query)
153
+ await connection.commit()
157
154
 
158
155
  @retry
159
156
  async def execute_many(self, query: str, dictionary: list[dict]) -> None:
@@ -165,11 +162,10 @@ class AsyncOracleConnection(object):
165
162
  :return: None
166
163
  """
167
164
 
168
- connection = self._session_pool.acquire()
169
- cursor = connection.cursor()
170
- await cursor.executemany(query, dictionary)
171
- await connection.commit()
172
- await self._session_pool.release(connection)
165
+ async with self._session_pool.acquire() as connection:
166
+ with connection.cursor() as cursor:
167
+ await cursor.executemany(query, dictionary)
168
+ await connection.commit()
173
169
 
174
170
  @retry
175
171
  async def fetch_data(self, query: str, packed_data=None):
@@ -181,14 +177,13 @@ class AsyncOracleConnection(object):
181
177
  :return: rows
182
178
  """
183
179
 
184
- connection = self._session_pool.acquire()
185
- cursor = connection.cursor()
186
- if packed_data:
187
- await cursor.execute(query, packed_data)
188
- else:
189
- await cursor.execute(query)
190
- rows = cursor.fetchall()
191
- await self._session_pool.release(connection)
180
+ async with self._session_pool.acquire() as connection:
181
+ with connection.cursor() as cursor:
182
+ if packed_data:
183
+ await cursor.execute(query, packed_data)
184
+ else:
185
+ await cursor.execute(query)
186
+ rows = await cursor.fetchall()
192
187
  return rows
193
188
 
194
189
  @retry
@@ -1,13 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wcp-library
3
- Version: 1.0.7
3
+ Version: 1.1.0
4
4
  Summary: Common utilites for internal development at WCP
5
5
  Home-page: https://github.com/Whitecap-DNA/WCP-Library
6
6
  Author: Mitch-Petersen
7
7
  Author-email: mitch.petersen@wcap.ca
8
- Requires-Python: >=3.11,<4.0
8
+ Requires-Python: >=3.12,<4.0
9
9
  Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.11
11
10
  Classifier: Programming Language :: Python :: 3.12
12
11
  Classifier: Programming Language :: Python :: 3.13
13
12
  Requires-Dist: aiohttp (>=3.10.10,<4.0.0)
@@ -4,7 +4,7 @@ wcp_library/async_credentials/api.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
4
4
  wcp_library/async_credentials/oracle.py,sha256=MvC7wsHnSyAyPGnRVlH0dvvW2xk5ap_IAByoHX4rUWY,5436
5
5
  wcp_library/async_credentials/postgres.py,sha256=3wjqtLH0Nc-U80iscYnz5DV-9M2X4IjPW51C5MI2_tI,5297
6
6
  wcp_library/async_sql/__init__.py,sha256=m4eWmUGYUEDomhhOp1ScB2uSIXFsNUNO589o5RwWdyM,1035
7
- wcp_library/async_sql/oracle.py,sha256=hyN8YwOxr4D_Twhj5uVb9T2LONYLoERjD-Mv9gNor8o,7385
7
+ wcp_library/async_sql/oracle.py,sha256=QHadNMWhJlCw27bWBIqtoDpfmm8GDMtAUYri_HbVMoc,7398
8
8
  wcp_library/async_sql/postgres.py,sha256=7ehET1l42gKnsOcqeWLcXBEdYfvvA1qVfdG0QJv57Vk,6593
9
9
  wcp_library/credentials/__init__.py,sha256=HRmg7mqcATeclIz3lZQjSR4nmK6aY6MK9-QXEYZoFrw,1857
10
10
  wcp_library/credentials/api.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -16,6 +16,6 @@ wcp_library/logging.py,sha256=h8p_Ezo_QPSIKrPxzIlNVXddU4IXHyp1_2NqVDirfuk,1958
16
16
  wcp_library/sql/__init__.py,sha256=CLlBEBrWVAwE79bUxuQiwikSrYH8m9QRYSJ2l0-ofsY,1003
17
17
  wcp_library/sql/oracle.py,sha256=ur91kgds11M7xiGlDNkodxu2P7M-crqK0toYJcOHgdo,7285
18
18
  wcp_library/sql/postgres.py,sha256=hIw9ckxV_iRqZA0rSCMmbG82iil8mY4g-ajtHYVIq3I,6492
19
- wcp_library-1.0.7.dist-info/METADATA,sha256=xwyrMB5HuJkSIdU9-Wd90HF41vWPRvT1-em2bgILFhg,1338
20
- wcp_library-1.0.7.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
21
- wcp_library-1.0.7.dist-info/RECORD,,
19
+ wcp_library-1.1.0.dist-info/METADATA,sha256=VgYJYmhdV99qaKoErB1yzbr7oUAwPQy-LUwFgz9eR4Q,1287
20
+ wcp_library-1.1.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
21
+ wcp_library-1.1.0.dist-info/RECORD,,