wcp-library 1.6.1__tar.gz → 1.6.2__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.
- {wcp_library-1.6.1 → wcp_library-1.6.2}/PKG-INFO +1 -1
- {wcp_library-1.6.1 → wcp_library-1.6.2}/pyproject.toml +1 -1
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/sql/oracle.py +88 -66
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/sql/postgres.py +44 -44
- {wcp_library-1.6.1 → wcp_library-1.6.2}/README.md +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/__init__.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/credentials/__init__.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/credentials/_credential_manager_asynchronous.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/credentials/_credential_manager_synchronous.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/credentials/api.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/credentials/ftp.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/credentials/internet.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/credentials/oracle.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/credentials/postgres.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/emailing.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/ftp/__init__.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/ftp/ftp.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/ftp/sftp.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/informatica.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/logging.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/selenium/__init__.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/selenium/_selenium_driver.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/selenium/selenium_helper.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/sql/__init__.py +0 -0
- {wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/time.py +0 -0
@@ -191,10 +191,12 @@ class OracleConnection(object):
|
|
191
191
|
"""
|
192
192
|
|
193
193
|
connection = self._get_connection()
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
194
|
+
cursor = connection.cursor()
|
195
|
+
cursor.execute(query)
|
196
|
+
connection.commit()
|
197
|
+
|
198
|
+
if self.use_pool:
|
199
|
+
self._session_pool.release(self._connection)
|
198
200
|
|
199
201
|
@retry
|
200
202
|
def safe_execute(self, query: str, packed_values: dict) -> None:
|
@@ -207,10 +209,12 @@ class OracleConnection(object):
|
|
207
209
|
"""
|
208
210
|
|
209
211
|
connection = self._get_connection()
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
212
|
+
cursor = connection.cursor()
|
213
|
+
cursor.execute(query, packed_values)
|
214
|
+
connection.commit()
|
215
|
+
|
216
|
+
if self.use_pool:
|
217
|
+
self._session_pool.release(self._connection)
|
214
218
|
|
215
219
|
@retry
|
216
220
|
def execute_multiple(self, queries: list[tuple[str, dict]]) -> None:
|
@@ -222,16 +226,18 @@ class OracleConnection(object):
|
|
222
226
|
"""
|
223
227
|
|
224
228
|
connection = self._get_connection()
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
229
|
+
cursor = connection.cursor()
|
230
|
+
for item in queries:
|
231
|
+
query = item[0]
|
232
|
+
packed_values = item[1]
|
233
|
+
if packed_values:
|
234
|
+
cursor.execute(query, packed_values)
|
235
|
+
else:
|
236
|
+
cursor.execute(query)
|
237
|
+
connection.commit()
|
238
|
+
|
239
|
+
if self.use_pool:
|
240
|
+
self._session_pool.release(self._connection)
|
235
241
|
|
236
242
|
@retry
|
237
243
|
def execute_many(self, query: str, dictionary: list[dict]) -> None:
|
@@ -244,10 +250,12 @@ class OracleConnection(object):
|
|
244
250
|
"""
|
245
251
|
|
246
252
|
connection = self._get_connection()
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
253
|
+
cursor = connection.cursor()
|
254
|
+
cursor.executemany(query, dictionary)
|
255
|
+
connection.commit()
|
256
|
+
|
257
|
+
if self.use_pool:
|
258
|
+
self._session_pool.release(self._connection)
|
251
259
|
|
252
260
|
@retry
|
253
261
|
def fetch_data(self, query: str, packed_data=None) -> list:
|
@@ -260,13 +268,16 @@ class OracleConnection(object):
|
|
260
268
|
"""
|
261
269
|
|
262
270
|
connection = self._get_connection()
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
271
|
+
cursor = connection.cursor()
|
272
|
+
if packed_data:
|
273
|
+
cursor.execute(query, packed_data)
|
274
|
+
else:
|
275
|
+
cursor.execute(query)
|
276
|
+
rows = cursor.fetchall()
|
277
|
+
connection.commit()
|
278
|
+
|
279
|
+
if self.use_pool:
|
280
|
+
self._session_pool.release(self._connection)
|
270
281
|
return rows
|
271
282
|
|
272
283
|
@retry
|
@@ -290,7 +301,7 @@ class OracleConnection(object):
|
|
290
301
|
params = param_list[0]
|
291
302
|
|
292
303
|
main_dict = df.to_dict('records')
|
293
|
-
query = f"
|
304
|
+
query = f"DELETE FROM {outputTableName} WHERE {params}"
|
294
305
|
self.execute_many(query, main_dict)
|
295
306
|
|
296
307
|
@retry
|
@@ -315,7 +326,7 @@ class OracleConnection(object):
|
|
315
326
|
dfObj = dfObj.replace({np.nan: None})
|
316
327
|
main_dict = dfObj.to_dict('records')
|
317
328
|
|
318
|
-
query = f"
|
329
|
+
query = f"INSERT INTO {outputTableName} ({col}) VALUES ({bind})"
|
319
330
|
self.execute_many(query, main_dict)
|
320
331
|
|
321
332
|
@retry
|
@@ -327,7 +338,7 @@ class OracleConnection(object):
|
|
327
338
|
:return: None
|
328
339
|
"""
|
329
340
|
|
330
|
-
truncateQuery = f"
|
341
|
+
truncateQuery = f"TRUNCATE TABLE {tableName}"
|
331
342
|
self.execute(truncateQuery)
|
332
343
|
|
333
344
|
@retry
|
@@ -339,7 +350,7 @@ class OracleConnection(object):
|
|
339
350
|
:return: None
|
340
351
|
"""
|
341
352
|
|
342
|
-
deleteQuery = f"
|
353
|
+
deleteQuery = f"DELETE FROM {tableName}"
|
343
354
|
self.execute(deleteQuery)
|
344
355
|
|
345
356
|
def __del__(self) -> None:
|
@@ -460,10 +471,12 @@ class AsyncOracleConnection(object):
|
|
460
471
|
"""
|
461
472
|
|
462
473
|
connection = await self._get_connection()
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
474
|
+
with connection.cursor() as cursor:
|
475
|
+
await cursor.execute(query)
|
476
|
+
await connection.commit()
|
477
|
+
|
478
|
+
if self.use_pool:
|
479
|
+
await self._session_pool.release(self._connection)
|
467
480
|
|
468
481
|
@async_retry
|
469
482
|
async def safe_execute(self, query: str, packed_values: dict) -> None:
|
@@ -476,10 +489,12 @@ class AsyncOracleConnection(object):
|
|
476
489
|
"""
|
477
490
|
|
478
491
|
connection = await self._get_connection()
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
492
|
+
with connection.cursor() as cursor:
|
493
|
+
await cursor.execute(query, packed_values)
|
494
|
+
await connection.commit()
|
495
|
+
|
496
|
+
if self.use_pool:
|
497
|
+
await self._session_pool.release(self._connection)
|
483
498
|
|
484
499
|
@async_retry
|
485
500
|
async def execute_multiple(self, queries: list[tuple[str, dict]]) -> None:
|
@@ -491,16 +506,18 @@ class AsyncOracleConnection(object):
|
|
491
506
|
"""
|
492
507
|
|
493
508
|
connection = await self._get_connection()
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
509
|
+
with connection.cursor() as cursor:
|
510
|
+
for item in queries:
|
511
|
+
query = item[0]
|
512
|
+
packed_values = item[1]
|
513
|
+
if packed_values:
|
514
|
+
await cursor.execute(query, packed_values)
|
515
|
+
else:
|
516
|
+
await cursor.execute(query)
|
517
|
+
await connection.commit()
|
518
|
+
|
519
|
+
if self.use_pool:
|
520
|
+
await self._session_pool.release(self._connection)
|
504
521
|
|
505
522
|
@async_retry
|
506
523
|
async def execute_many(self, query: str, dictionary: list[dict]) -> None:
|
@@ -513,10 +530,12 @@ class AsyncOracleConnection(object):
|
|
513
530
|
"""
|
514
531
|
|
515
532
|
connection = await self._get_connection()
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
533
|
+
with connection.cursor() as cursor:
|
534
|
+
await cursor.executemany(query, dictionary)
|
535
|
+
await connection.commit()
|
536
|
+
|
537
|
+
if self.use_pool:
|
538
|
+
await self._session_pool.release(self._connection)
|
520
539
|
|
521
540
|
@async_retry
|
522
541
|
async def fetch_data(self, query: str, packed_data=None) -> list:
|
@@ -529,13 +548,16 @@ class AsyncOracleConnection(object):
|
|
529
548
|
"""
|
530
549
|
|
531
550
|
connection = await self._get_connection()
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
551
|
+
with connection.cursor() as cursor:
|
552
|
+
if packed_data:
|
553
|
+
await cursor.execute(query, packed_data)
|
554
|
+
else:
|
555
|
+
await cursor.execute(query)
|
556
|
+
rows = await cursor.fetchall()
|
557
|
+
await connection.commit()
|
558
|
+
|
559
|
+
if self.use_pool:
|
560
|
+
await self._session_pool.release(self._connection)
|
539
561
|
return rows
|
540
562
|
|
541
563
|
@async_retry
|
@@ -559,7 +581,7 @@ class AsyncOracleConnection(object):
|
|
559
581
|
params = param_list[0]
|
560
582
|
|
561
583
|
main_dict = df.to_dict('records')
|
562
|
-
query = f"
|
584
|
+
query = f"DELETE FROM {outputTableName} WHERE {params}"
|
563
585
|
await self.execute_many(query, main_dict)
|
564
586
|
|
565
587
|
@async_retry
|
@@ -584,7 +606,7 @@ class AsyncOracleConnection(object):
|
|
584
606
|
dfObj = dfObj.replace({np.nan: None})
|
585
607
|
main_dict = dfObj.to_dict('records')
|
586
608
|
|
587
|
-
query = f"
|
609
|
+
query = f"INSERT INTO {outputTableName} ({col}) VALUES ({bind})"
|
588
610
|
await self.execute_many(query, main_dict)
|
589
611
|
|
590
612
|
@async_retry
|
@@ -596,7 +618,7 @@ class AsyncOracleConnection(object):
|
|
596
618
|
:return: None
|
597
619
|
"""
|
598
620
|
|
599
|
-
truncateQuery = f"
|
621
|
+
truncateQuery = f"TRUNCATE TABLE {tableName}"
|
600
622
|
await self.execute(truncateQuery)
|
601
623
|
|
602
624
|
@async_retry
|
@@ -608,5 +630,5 @@ class AsyncOracleConnection(object):
|
|
608
630
|
:return: None
|
609
631
|
"""
|
610
632
|
|
611
|
-
deleteQuery = f"
|
633
|
+
deleteQuery = f"DELETE FROM {tableName}"
|
612
634
|
await self.execute(deleteQuery)
|
@@ -182,8 +182,8 @@ class PostgresConnection(object):
|
|
182
182
|
"""
|
183
183
|
|
184
184
|
connection = self._get_connection()
|
185
|
-
|
186
|
-
|
185
|
+
connection.execute(query)
|
186
|
+
connection.commit()
|
187
187
|
|
188
188
|
if self.use_pool:
|
189
189
|
self._session_pool.putconn(connection)
|
@@ -199,8 +199,8 @@ class PostgresConnection(object):
|
|
199
199
|
"""
|
200
200
|
|
201
201
|
connection = self._get_connection()
|
202
|
-
|
203
|
-
|
202
|
+
connection.execute(query, packed_values)
|
203
|
+
connection.commit()
|
204
204
|
|
205
205
|
if self.use_pool:
|
206
206
|
self._session_pool.putconn(connection)
|
@@ -215,14 +215,14 @@ class PostgresConnection(object):
|
|
215
215
|
"""
|
216
216
|
|
217
217
|
connection = self._get_connection()
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
218
|
+
for item in queries:
|
219
|
+
query = item[0]
|
220
|
+
packed_values = item[1]
|
221
|
+
if packed_values:
|
222
|
+
connection.execute(query, packed_values)
|
223
|
+
else:
|
224
|
+
connection.execute(query)
|
225
|
+
connection.commit()
|
226
226
|
|
227
227
|
if self.use_pool:
|
228
228
|
self._session_pool.putconn(connection)
|
@@ -238,9 +238,9 @@ class PostgresConnection(object):
|
|
238
238
|
"""
|
239
239
|
|
240
240
|
connection = self._get_connection()
|
241
|
-
|
242
|
-
|
243
|
-
|
241
|
+
cursor = connection.cursor()
|
242
|
+
cursor.executemany(query, dictionary)
|
243
|
+
connection.commit()
|
244
244
|
|
245
245
|
if self.use_pool:
|
246
246
|
self._session_pool.putconn(connection)
|
@@ -256,13 +256,13 @@ class PostgresConnection(object):
|
|
256
256
|
"""
|
257
257
|
|
258
258
|
connection = self._get_connection()
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
259
|
+
cursor = connection.cursor()
|
260
|
+
if packed_data:
|
261
|
+
cursor.execute(query, packed_data)
|
262
|
+
else:
|
263
|
+
cursor.execute(query)
|
264
|
+
rows = cursor.fetchall()
|
265
|
+
connection.commit()
|
266
266
|
|
267
267
|
if self.use_pool:
|
268
268
|
self._session_pool.putconn(connection)
|
@@ -457,8 +457,8 @@ class AsyncPostgresConnection(object):
|
|
457
457
|
"""
|
458
458
|
|
459
459
|
connection = await self._get_connection()
|
460
|
-
|
461
|
-
|
460
|
+
await connection.execute(query)
|
461
|
+
await connection.commit()
|
462
462
|
|
463
463
|
if self.use_pool:
|
464
464
|
await self._session_pool.putconn(connection)
|
@@ -474,8 +474,8 @@ class AsyncPostgresConnection(object):
|
|
474
474
|
"""
|
475
475
|
|
476
476
|
connection = await self._get_connection()
|
477
|
-
|
478
|
-
|
477
|
+
await connection.execute(query, packed_values)
|
478
|
+
await connection.commit()
|
479
479
|
|
480
480
|
if self.use_pool:
|
481
481
|
await self._session_pool.putconn(connection)
|
@@ -490,14 +490,14 @@ class AsyncPostgresConnection(object):
|
|
490
490
|
"""
|
491
491
|
|
492
492
|
connection = await self._get_connection()
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
493
|
+
for item in queries:
|
494
|
+
query = item[0]
|
495
|
+
packed_values = item[1]
|
496
|
+
if packed_values:
|
497
|
+
await connection.execute(query, packed_values)
|
498
|
+
else:
|
499
|
+
await connection.execute(query)
|
500
|
+
await connection.commit()
|
501
501
|
|
502
502
|
if self.use_pool:
|
503
503
|
await self._session_pool.putconn(connection)
|
@@ -513,9 +513,9 @@ class AsyncPostgresConnection(object):
|
|
513
513
|
"""
|
514
514
|
|
515
515
|
connection = await self._get_connection()
|
516
|
-
|
517
|
-
|
518
|
-
|
516
|
+
cursor = connection.cursor()
|
517
|
+
await cursor.executemany(query, dictionary)
|
518
|
+
await connection.commit()
|
519
519
|
|
520
520
|
if self.use_pool:
|
521
521
|
await self._session_pool.putconn(connection)
|
@@ -531,13 +531,13 @@ class AsyncPostgresConnection(object):
|
|
531
531
|
"""
|
532
532
|
|
533
533
|
connection = await self._get_connection()
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
534
|
+
cursor = connection.cursor()
|
535
|
+
if packed_data:
|
536
|
+
await cursor.execute(query, packed_data)
|
537
|
+
else:
|
538
|
+
await cursor.execute(query)
|
539
|
+
rows = await cursor.fetchall()
|
540
|
+
await connection.commit()
|
541
541
|
|
542
542
|
if self.use_pool:
|
543
543
|
await self._session_pool.putconn(connection)
|
File without changes
|
File without changes
|
File without changes
|
{wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/credentials/_credential_manager_asynchronous.py
RENAMED
File without changes
|
{wcp_library-1.6.1 → wcp_library-1.6.2}/wcp_library/credentials/_credential_manager_synchronous.py
RENAMED
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
|