wcp-library 1.0.4__py3-none-any.whl → 1.0.6__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/__init__.py +1 -1
- wcp_library/async_sql/oracle.py +12 -7
- wcp_library/async_sql/postgres.py +12 -5
- wcp_library/sql/oracle.py +12 -5
- wcp_library/sql/postgres.py +12 -5
- {wcp_library-1.0.4.dist-info → wcp_library-1.0.6.dist-info}/METADATA +1 -1
- {wcp_library-1.0.4.dist-info → wcp_library-1.0.6.dist-info}/RECORD +8 -8
- {wcp_library-1.0.4.dist-info → wcp_library-1.0.6.dist-info}/WHEEL +0 -0
wcp_library/__init__.py
CHANGED
@@ -11,4 +11,4 @@ if getattr(sys, 'frozen', False):
|
|
11
11
|
application_path = sys.executable + '-'
|
12
12
|
application_path = Path(application_path).parent
|
13
13
|
else:
|
14
|
-
application_path = Path(os.
|
14
|
+
application_path = Path(os.environ['VIRTUAL_ENV']).parent
|
wcp_library/async_sql/oracle.py
CHANGED
@@ -10,7 +10,8 @@ from wcp_library.async_sql import retry
|
|
10
10
|
logger = logging.getLogger(__name__)
|
11
11
|
|
12
12
|
|
13
|
-
async def connect_warehouse(username: str, password: str, hostname: str, port: int, database: str
|
13
|
+
async def connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
|
14
|
+
max_connections: int) -> AsyncConnectionPool:
|
14
15
|
"""
|
15
16
|
Create Warehouse Connection
|
16
17
|
|
@@ -19,6 +20,8 @@ async def connect_warehouse(username: str, password: str, hostname: str, port: i
|
|
19
20
|
:param hostname: hostname
|
20
21
|
:param port: port
|
21
22
|
:param database: database
|
23
|
+
:param min_connections:
|
24
|
+
:param max_connections:
|
22
25
|
:return: session_pool
|
23
26
|
"""
|
24
27
|
|
@@ -27,10 +30,9 @@ async def connect_warehouse(username: str, password: str, hostname: str, port: i
|
|
27
30
|
user=username,
|
28
31
|
password=password,
|
29
32
|
dsn=dsn,
|
30
|
-
min=
|
31
|
-
max=
|
33
|
+
min=min_connections,
|
34
|
+
max=max_connections,
|
32
35
|
increment=1,
|
33
|
-
threaded=True,
|
34
36
|
encoding="UTF-8"
|
35
37
|
)
|
36
38
|
return session_pool
|
@@ -43,7 +45,7 @@ class AsyncOracleConnection(object):
|
|
43
45
|
:return: None
|
44
46
|
"""
|
45
47
|
|
46
|
-
def __init__(self):
|
48
|
+
def __init__(self, min_connections: int = 2, max_connections: int = 5):
|
47
49
|
self._db_service: str = "Oracle"
|
48
50
|
self._username: Optional[str] = None
|
49
51
|
self._password: Optional[str] = None
|
@@ -53,6 +55,9 @@ class AsyncOracleConnection(object):
|
|
53
55
|
self._sid: Optional[str] = None
|
54
56
|
self._session_pool: Optional[AsyncConnectionPool] = None
|
55
57
|
|
58
|
+
self.min_connections = min_connections
|
59
|
+
self.max_connections = max_connections
|
60
|
+
|
56
61
|
self._retry_count = 0
|
57
62
|
self.retry_limit = 50
|
58
63
|
self.retry_error_codes = ['ORA-01033', 'DPY-6005', 'DPY-4011']
|
@@ -67,8 +72,8 @@ class AsyncOracleConnection(object):
|
|
67
72
|
|
68
73
|
sid_or_service = self._database if self._database else self._sid
|
69
74
|
|
70
|
-
self._session_pool = connect_warehouse(self._username, self._password, self._hostname, self._port,
|
71
|
-
|
75
|
+
self._session_pool = await connect_warehouse(self._username, self._password, self._hostname, self._port,
|
76
|
+
sid_or_service, self.min_connections, self.max_connections)
|
72
77
|
|
73
78
|
async def set_user(self, credentials_dict: dict) -> None:
|
74
79
|
"""
|
@@ -10,7 +10,8 @@ from wcp_library.async_sql import retry
|
|
10
10
|
logger = logging.getLogger(__name__)
|
11
11
|
|
12
12
|
|
13
|
-
async def connect_warehouse(username: str, password: str, hostname: str, port: int, database: str
|
13
|
+
async def connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
|
14
|
+
max_connections: int) -> AsyncConnectionPool:
|
14
15
|
"""
|
15
16
|
Create Warehouse Connection
|
16
17
|
|
@@ -19,6 +20,8 @@ async def connect_warehouse(username: str, password: str, hostname: str, port: i
|
|
19
20
|
:param hostname: hostname
|
20
21
|
:param port: port
|
21
22
|
:param database: database
|
23
|
+
:param min_connections:
|
24
|
+
:param max_connections:
|
22
25
|
:return: session_pool
|
23
26
|
"""
|
24
27
|
|
@@ -26,8 +29,8 @@ async def connect_warehouse(username: str, password: str, hostname: str, port: i
|
|
26
29
|
|
27
30
|
session_pool = AsyncConnectionPool(
|
28
31
|
conninfo=url,
|
29
|
-
min_size=
|
30
|
-
max_size=
|
32
|
+
min_size=min_connections,
|
33
|
+
max_size=max_connections,
|
31
34
|
)
|
32
35
|
await session_pool.open()
|
33
36
|
return session_pool
|
@@ -40,7 +43,7 @@ class AsyncPostgresConnection(object):
|
|
40
43
|
:return: None
|
41
44
|
"""
|
42
45
|
|
43
|
-
def __init__(self):
|
46
|
+
def __init__(self, min_connections: int = 2, max_connections: int = 5):
|
44
47
|
self._username: Optional[str] = None
|
45
48
|
self._password: Optional[str] = None
|
46
49
|
self._hostname: Optional[str] = None
|
@@ -48,6 +51,9 @@ class AsyncPostgresConnection(object):
|
|
48
51
|
self._database: Optional[str] = None
|
49
52
|
self._session_pool: Optional[AsyncConnectionPool] = None
|
50
53
|
|
54
|
+
self.min_connections = min_connections
|
55
|
+
self.max_connections = max_connections
|
56
|
+
|
51
57
|
self._retry_count = 0
|
52
58
|
self.retry_limit = 50
|
53
59
|
self.retry_error_codes = ['08001', '08004']
|
@@ -60,7 +66,8 @@ class AsyncPostgresConnection(object):
|
|
60
66
|
:return: None
|
61
67
|
"""
|
62
68
|
|
63
|
-
self._session_pool = await connect_warehouse(self._username, self._password, self._hostname, self._port,
|
69
|
+
self._session_pool = await connect_warehouse(self._username, self._password, self._hostname, self._port,
|
70
|
+
self._database, self.min_connections, self.max_connections)
|
64
71
|
|
65
72
|
async def set_user(self, credentials_dict: dict) -> None:
|
66
73
|
"""
|
wcp_library/sql/oracle.py
CHANGED
@@ -10,7 +10,8 @@ from wcp_library.sql import retry
|
|
10
10
|
logger = logging.getLogger(__name__)
|
11
11
|
|
12
12
|
|
13
|
-
def connect_warehouse(username: str, password: str, hostname: str, port: int, database: str
|
13
|
+
def connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
|
14
|
+
max_connections: int) -> ConnectionPool:
|
14
15
|
"""
|
15
16
|
Create Warehouse Connection
|
16
17
|
|
@@ -19,6 +20,8 @@ def connect_warehouse(username: str, password: str, hostname: str, port: int, da
|
|
19
20
|
:param hostname: hostname
|
20
21
|
:param port: port
|
21
22
|
:param database: database
|
23
|
+
:param min_connections:
|
24
|
+
:param max_connections:
|
22
25
|
:return: session_pool
|
23
26
|
"""
|
24
27
|
|
@@ -27,8 +30,8 @@ def connect_warehouse(username: str, password: str, hostname: str, port: int, da
|
|
27
30
|
user=username,
|
28
31
|
password=password,
|
29
32
|
dsn=dsn,
|
30
|
-
min=
|
31
|
-
max=
|
33
|
+
min=min_connections,
|
34
|
+
max=max_connections,
|
32
35
|
increment=1,
|
33
36
|
threaded=True,
|
34
37
|
encoding="UTF-8"
|
@@ -43,7 +46,7 @@ class OracleConnection(object):
|
|
43
46
|
:return: None
|
44
47
|
"""
|
45
48
|
|
46
|
-
def __init__(self):
|
49
|
+
def __init__(self, min_connections: int = 2, max_connections: int = 5):
|
47
50
|
self._username: Optional[str] = None
|
48
51
|
self._password: Optional[str] = None
|
49
52
|
self._hostname: Optional[str] = None
|
@@ -52,6 +55,9 @@ class OracleConnection(object):
|
|
52
55
|
self._sid: Optional[str] = None
|
53
56
|
self._session_pool: Optional[ConnectionPool] = None
|
54
57
|
|
58
|
+
self.min_connections = min_connections
|
59
|
+
self.max_connections = max_connections
|
60
|
+
|
55
61
|
self._retry_count = 0
|
56
62
|
self.retry_limit = 50
|
57
63
|
self.retry_error_codes = ['ORA-01033', 'DPY-6005', 'DPY-4011']
|
@@ -66,7 +72,8 @@ class OracleConnection(object):
|
|
66
72
|
|
67
73
|
sid_or_service = self._database if self._database else self._sid
|
68
74
|
|
69
|
-
self._session_pool = connect_warehouse(self._username, self._password, self._hostname, self._port,
|
75
|
+
self._session_pool = connect_warehouse(self._username, self._password, self._hostname, self._port,
|
76
|
+
sid_or_service, self.min_connections, self.max_connections)
|
70
77
|
|
71
78
|
def set_user(self, credentials_dict: dict) -> None:
|
72
79
|
"""
|
wcp_library/sql/postgres.py
CHANGED
@@ -10,7 +10,8 @@ from wcp_library.sql import retry
|
|
10
10
|
logger = logging.getLogger(__name__)
|
11
11
|
|
12
12
|
|
13
|
-
def connect_warehouse(username: str, password: str, hostname: str, port: int, database: str
|
13
|
+
def connect_warehouse(username: str, password: str, hostname: str, port: int, database: str, min_connections: int,
|
14
|
+
max_connections: int) -> ConnectionPool:
|
14
15
|
"""
|
15
16
|
Create Warehouse Connection
|
16
17
|
|
@@ -19,6 +20,8 @@ def connect_warehouse(username: str, password: str, hostname: str, port: int, da
|
|
19
20
|
:param hostname: hostname
|
20
21
|
:param port: port
|
21
22
|
:param database: database
|
23
|
+
:param min_connections:
|
24
|
+
:param max_connections:
|
22
25
|
:return: session_pool
|
23
26
|
"""
|
24
27
|
|
@@ -26,8 +29,8 @@ def connect_warehouse(username: str, password: str, hostname: str, port: int, da
|
|
26
29
|
|
27
30
|
session_pool = ConnectionPool(
|
28
31
|
conninfo=url,
|
29
|
-
min_size=
|
30
|
-
max_size=
|
32
|
+
min_size=min_connections,
|
33
|
+
max_size=max_connections,
|
31
34
|
open=True
|
32
35
|
)
|
33
36
|
return session_pool
|
@@ -40,7 +43,7 @@ class PostgresConnection(object):
|
|
40
43
|
:return: None
|
41
44
|
"""
|
42
45
|
|
43
|
-
def __init__(self):
|
46
|
+
def __init__(self, min_connections: int = 2, max_connections: int = 5):
|
44
47
|
self._username: Optional[str] = None
|
45
48
|
self._password: Optional[str] = None
|
46
49
|
self._hostname: Optional[str] = None
|
@@ -48,6 +51,9 @@ class PostgresConnection(object):
|
|
48
51
|
self._database: Optional[str] = None
|
49
52
|
self._session_pool: Optional[ConnectionPool] = None
|
50
53
|
|
54
|
+
self.min_connections = min_connections
|
55
|
+
self.max_connections = max_connections
|
56
|
+
|
51
57
|
self._retry_count = 0
|
52
58
|
self.retry_limit = 50
|
53
59
|
self.retry_error_codes = ['08001', '08004']
|
@@ -60,7 +66,8 @@ class PostgresConnection(object):
|
|
60
66
|
:return: None
|
61
67
|
"""
|
62
68
|
|
63
|
-
self._session_pool = connect_warehouse(self._username, self._password, self._hostname, self._port,
|
69
|
+
self._session_pool = connect_warehouse(self._username, self._password, self._hostname, self._port,
|
70
|
+
self._database, self.min_connections, self.max_connections)
|
64
71
|
|
65
72
|
def set_user(self, credentials_dict: dict) -> None:
|
66
73
|
"""
|
@@ -1,11 +1,11 @@
|
|
1
|
-
wcp_library/__init__.py,sha256=
|
1
|
+
wcp_library/__init__.py,sha256=vgWnSAz9S7evUpt8lfZVBg2NWAn-wenaAaPcBnfJxxc,327
|
2
2
|
wcp_library/async_credentials/__init__.py,sha256=ny6UitVV_xIecVzaWuHrJO9LpywBPke6u4C0F2wiM7o,1881
|
3
3
|
wcp_library/async_credentials/api.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
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=cqEWyCgyvAD0gwMUlXOhnW2hI02IPJfjwyyhs06pri8,7411
|
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
|
11
11
|
wcp_library/credentials/oracle.py,sha256=tinrog9TLW6jw7j8S-Ese_VHnhFcAoOPJpHsE0Xwx6M,5094
|
@@ -14,8 +14,8 @@ wcp_library/emailing.py,sha256=T8WXvMRA6cC0uRvyCw9yZcI-pAnCn0Gbn5B_ftRzEqA,2462
|
|
14
14
|
wcp_library/informatica.py,sha256=IXZtk_9X1XLbOEwFrsyOwTgajQKvtXgANBHmuTOP3Kk,4064
|
15
15
|
wcp_library/logging.py,sha256=h8p_Ezo_QPSIKrPxzIlNVXddU4IXHyp1_2NqVDirfuk,1958
|
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.0.
|
20
|
-
wcp_library-1.0.
|
21
|
-
wcp_library-1.0.
|
17
|
+
wcp_library/sql/oracle.py,sha256=ur91kgds11M7xiGlDNkodxu2P7M-crqK0toYJcOHgdo,7285
|
18
|
+
wcp_library/sql/postgres.py,sha256=hIw9ckxV_iRqZA0rSCMmbG82iil8mY4g-ajtHYVIq3I,6492
|
19
|
+
wcp_library-1.0.6.dist-info/METADATA,sha256=c0TbPZ1rbmadB7lQ2Jdc2tR-7b7bPjkRMrsgfkUISaE,1338
|
20
|
+
wcp_library-1.0.6.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
21
|
+
wcp_library-1.0.6.dist-info/RECORD,,
|
File without changes
|