wcp-library 1.0.8__py3-none-any.whl → 1.1.2__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/async_sql/oracle.py +5 -5
- wcp_library/async_sql/postgres.py +4 -4
- wcp_library/emailing.py +3 -3
- wcp_library/logging.py +6 -5
- wcp_library/sql/oracle.py +4 -4
- wcp_library/sql/postgres.py +3 -3
- {wcp_library-1.0.8.dist-info → wcp_library-1.1.2.dist-info}/METADATA +3 -4
- {wcp_library-1.0.8.dist-info → wcp_library-1.1.2.dist-info}/RECORD +9 -9
- {wcp_library-1.0.8.dist-info → wcp_library-1.1.2.dist-info}/WHEEL +0 -0
wcp_library/async_sql/oracle.py
CHANGED
@@ -10,8 +10,8 @@ from wcp_library.async_sql import retry
|
|
10
10
|
logger = logging.getLogger(__name__)
|
11
11
|
|
12
12
|
|
13
|
-
async def
|
14
|
-
|
13
|
+
async def _connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
|
14
|
+
max_connections: int) -> AsyncConnectionPool:
|
15
15
|
"""
|
16
16
|
Create Warehouse Connection
|
17
17
|
|
@@ -71,8 +71,8 @@ class AsyncOracleConnection(object):
|
|
71
71
|
|
72
72
|
sid_or_service = self._database if self._database else self._sid
|
73
73
|
|
74
|
-
self._session_pool = await
|
75
|
-
|
74
|
+
self._session_pool = await _connect_warehouse(self._username, self._password, self._hostname, self._port,
|
75
|
+
sid_or_service, self.min_connections, self.max_connections)
|
76
76
|
|
77
77
|
async def set_user(self, credentials_dict: dict) -> None:
|
78
78
|
"""
|
@@ -183,7 +183,7 @@ class AsyncOracleConnection(object):
|
|
183
183
|
await cursor.execute(query, packed_data)
|
184
184
|
else:
|
185
185
|
await cursor.execute(query)
|
186
|
-
rows = cursor.fetchall()
|
186
|
+
rows = await cursor.fetchall()
|
187
187
|
return rows
|
188
188
|
|
189
189
|
@retry
|
@@ -10,8 +10,8 @@ from wcp_library.async_sql import retry
|
|
10
10
|
logger = logging.getLogger(__name__)
|
11
11
|
|
12
12
|
|
13
|
-
async def
|
14
|
-
|
13
|
+
async def _connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
|
14
|
+
max_connections: int) -> AsyncConnectionPool:
|
15
15
|
"""
|
16
16
|
Create Warehouse Connection
|
17
17
|
|
@@ -66,8 +66,8 @@ class AsyncPostgresConnection(object):
|
|
66
66
|
:return: None
|
67
67
|
"""
|
68
68
|
|
69
|
-
self._session_pool = await
|
70
|
-
|
69
|
+
self._session_pool = await _connect_warehouse(self._username, self._password, self._hostname, self._port,
|
70
|
+
self._database, self.min_connections, self.max_connections)
|
71
71
|
|
72
72
|
async def set_user(self, credentials_dict: dict) -> None:
|
73
73
|
"""
|
wcp_library/emailing.py
CHANGED
@@ -7,7 +7,7 @@ from email.utils import formatdate
|
|
7
7
|
from pathlib import Path
|
8
8
|
|
9
9
|
|
10
|
-
def send_email(sender: str, recipients: list, subject: str, message=None):
|
10
|
+
def send_email(sender: str, recipients: list, subject: str, message: str=None) -> None:
|
11
11
|
"""
|
12
12
|
Function to send an email
|
13
13
|
|
@@ -32,7 +32,7 @@ def send_email(sender: str, recipients: list, subject: str, message=None):
|
|
32
32
|
server.quit()
|
33
33
|
|
34
34
|
|
35
|
-
def email_reporting(subject: str, message: str):
|
35
|
+
def email_reporting(subject: str, message: str) -> None:
|
36
36
|
"""
|
37
37
|
Function to email the reporting team from the Python email
|
38
38
|
|
@@ -55,7 +55,7 @@ def email_reporting(subject: str, message: str):
|
|
55
55
|
server.quit()
|
56
56
|
|
57
57
|
|
58
|
-
def email_with_attachments(sender: str, recipients: list, subject: str, message=None, attachments: list[Path]=None):
|
58
|
+
def email_with_attachments(sender: str, recipients: list, subject: str, message: str=None, attachments: list[Path]=None) -> None:
|
59
59
|
"""
|
60
60
|
Function to send an email with attachments
|
61
61
|
|
wcp_library/logging.py
CHANGED
@@ -4,7 +4,7 @@ import sys
|
|
4
4
|
from wcp_library import application_path
|
5
5
|
|
6
6
|
|
7
|
-
def create_log(
|
7
|
+
def create_log(file_level: int, console_level: int, iterations: int, project_name: str, mode: str = "w",
|
8
8
|
format: str = "%(asctime)s:%(levelname)s:%(module)s:%(filename)s:%(lineno)d:%(message)s"):
|
9
9
|
"""
|
10
10
|
Create log file.
|
@@ -13,7 +13,8 @@ def create_log(level: int, iterations: int, project_name: str, mode: str = "w",
|
|
13
13
|
|
14
14
|
format help: https://docs.python.org/3/library/logging.html#logrecord-attributes
|
15
15
|
|
16
|
-
:param
|
16
|
+
:param file_level: Logging level to output to log file.
|
17
|
+
:param console_level: Logging level to output to console.
|
17
18
|
:param iterations: Number of log files to keep.
|
18
19
|
:param project_name: Name of the project. (Used as the log file name)
|
19
20
|
:param mode: Mode to open the log file. (Default: "w")
|
@@ -33,12 +34,12 @@ def create_log(level: int, iterations: int, project_name: str, mode: str = "w",
|
|
33
34
|
|
34
35
|
logging.basicConfig(
|
35
36
|
filename=(application_path / (project_name + ".log")),
|
36
|
-
level=
|
37
|
+
level=file_level,
|
37
38
|
format=format,
|
38
39
|
filemode=mode
|
39
40
|
)
|
40
41
|
|
41
|
-
MIN_LEVEL =
|
42
|
+
MIN_LEVEL = console_level
|
42
43
|
stdout_hdlr = logging.StreamHandler(sys.stdout)
|
43
44
|
stderr_hdlr = logging.StreamHandler(sys.stderr)
|
44
45
|
stdout_hdlr.setLevel(MIN_LEVEL)
|
@@ -48,4 +49,4 @@ def create_log(level: int, iterations: int, project_name: str, mode: str = "w",
|
|
48
49
|
rootLogger.addHandler(stdout_hdlr)
|
49
50
|
rootLogger.addHandler(stderr_hdlr)
|
50
51
|
logger = logging.getLogger(__name__)
|
51
|
-
logger.setLevel(
|
52
|
+
logger.setLevel(console_level)
|
wcp_library/sql/oracle.py
CHANGED
@@ -10,8 +10,8 @@ from wcp_library.sql import retry
|
|
10
10
|
logger = logging.getLogger(__name__)
|
11
11
|
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def _connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
|
14
|
+
max_connections: int) -> ConnectionPool:
|
15
15
|
"""
|
16
16
|
Create Warehouse Connection
|
17
17
|
|
@@ -72,8 +72,8 @@ class OracleConnection(object):
|
|
72
72
|
|
73
73
|
sid_or_service = self._database if self._database else self._sid
|
74
74
|
|
75
|
-
self._session_pool =
|
76
|
-
|
75
|
+
self._session_pool = _connect_warehouse(self._username, self._password, self._hostname, self._port,
|
76
|
+
sid_or_service, self.min_connections, self.max_connections)
|
77
77
|
|
78
78
|
def set_user(self, credentials_dict: dict) -> None:
|
79
79
|
"""
|
wcp_library/sql/postgres.py
CHANGED
@@ -10,8 +10,8 @@ from wcp_library.sql import retry
|
|
10
10
|
logger = logging.getLogger(__name__)
|
11
11
|
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def _connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
|
14
|
+
max_connections: int) -> ConnectionPool:
|
15
15
|
"""
|
16
16
|
Create Warehouse Connection
|
17
17
|
|
@@ -66,7 +66,7 @@ class PostgresConnection(object):
|
|
66
66
|
:return: None
|
67
67
|
"""
|
68
68
|
|
69
|
-
self._session_pool =
|
69
|
+
self._session_pool = _connect_warehouse(self._username, self._password, self._hostname, self._port,
|
70
70
|
self._database, self.min_connections, self.max_connections)
|
71
71
|
|
72
72
|
def set_user(self, credentials_dict: dict) -> None:
|
@@ -1,13 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: wcp-library
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.1.2
|
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.
|
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)
|
@@ -33,7 +32,7 @@ Commonly used functions for the D&A team.
|
|
33
32
|
`pip install WCP-Library`
|
34
33
|
|
35
34
|
## Usage
|
36
|
-
See Wiki for more information.
|
35
|
+
See [Wiki](https://github.com/Whitecap-DNA/WCP-Library/wiki/) for more information.
|
37
36
|
|
38
37
|
## Authors and acknowledgment
|
39
38
|
Mitch Petersen
|
@@ -4,18 +4,18 @@ 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=
|
8
|
-
wcp_library/async_sql/postgres.py,sha256=
|
7
|
+
wcp_library/async_sql/oracle.py,sha256=T4wLdX3sHQQOfDNqb35GM4wHFP5Vs5veB7iQtdCxPVM,7402
|
8
|
+
wcp_library/async_sql/postgres.py,sha256=MGPv1ffUDn7oJX1ojviVD3N7jk8dtQERnbDateuwZJo,6597
|
9
9
|
wcp_library/credentials/__init__.py,sha256=HRmg7mqcATeclIz3lZQjSR4nmK6aY6MK9-QXEYZoFrw,1857
|
10
10
|
wcp_library/credentials/api.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
wcp_library/credentials/oracle.py,sha256=tinrog9TLW6jw7j8S-Ese_VHnhFcAoOPJpHsE0Xwx6M,5094
|
12
12
|
wcp_library/credentials/postgres.py,sha256=Li-4nDMMxKGYh-hKhhL1r9M4wIc_TRgEgP1_UkEf-90,4955
|
13
|
-
wcp_library/emailing.py,sha256=
|
13
|
+
wcp_library/emailing.py,sha256=xqNly6Tmj-pvwl5bdys3gauZFDd4SuWCQYzGFNemv2Q,2496
|
14
14
|
wcp_library/informatica.py,sha256=IXZtk_9X1XLbOEwFrsyOwTgajQKvtXgANBHmuTOP3Kk,4064
|
15
|
-
wcp_library/logging.py,sha256=
|
15
|
+
wcp_library/logging.py,sha256=cFaY7kHEV1DukNiIVIsckrS046vBQ3W9sbFDfP1tcPk,2056
|
16
16
|
wcp_library/sql/__init__.py,sha256=CLlBEBrWVAwE79bUxuQiwikSrYH8m9QRYSJ2l0-ofsY,1003
|
17
|
-
wcp_library/sql/oracle.py,sha256=
|
18
|
-
wcp_library/sql/postgres.py,sha256=
|
19
|
-
wcp_library-1.
|
20
|
-
wcp_library-1.
|
21
|
-
wcp_library-1.
|
17
|
+
wcp_library/sql/oracle.py,sha256=FeMvqLte26vNQlR1esdZAUICy9IqOuE0zTTrx245bhY,7283
|
18
|
+
wcp_library/sql/postgres.py,sha256=I2iDQ13z_hbEfpFBliozLfsg8xUdSzEVqr12yyPSdh4,6489
|
19
|
+
wcp_library-1.1.2.dist-info/METADATA,sha256=Ah_GPMl1nrjkQz8Qw_Zcka_FItObTpz2oAi4zktVRaE,1340
|
20
|
+
wcp_library-1.1.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
21
|
+
wcp_library-1.1.2.dist-info/RECORD,,
|
File without changes
|