wcp-library 1.3.8__py3-none-any.whl → 1.3.9__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/postgres.py
CHANGED
@@ -3,6 +3,7 @@ from typing import Optional
|
|
3
3
|
|
4
4
|
import numpy as np
|
5
5
|
import pandas as pd
|
6
|
+
from psycopg.conninfo import make_conninfo
|
6
7
|
from psycopg.sql import SQL
|
7
8
|
from psycopg_pool import AsyncConnectionPool, ConnectionPool
|
8
9
|
|
@@ -26,10 +27,11 @@ def _connect_warehouse(username: str, password: str, hostname: str, port: int, d
|
|
26
27
|
:return: session_pool
|
27
28
|
"""
|
28
29
|
|
29
|
-
|
30
|
+
conn_string = f"dbname={database} user={username} password={password} host={hostname} port={port}"
|
31
|
+
conninfo = make_conninfo(conn_string)
|
30
32
|
|
31
33
|
session_pool = ConnectionPool(
|
32
|
-
conninfo=
|
34
|
+
conninfo=conninfo,
|
33
35
|
min_size=min_connections,
|
34
36
|
max_size=max_connections,
|
35
37
|
open=True
|
@@ -52,14 +54,14 @@ async def _async_connect_warehouse(username: str, password: str, hostname: str,
|
|
52
54
|
:return: session_pool
|
53
55
|
"""
|
54
56
|
|
55
|
-
|
57
|
+
conn_string = f"dbname={database} user={username} password={password} host={hostname} port={port}"
|
58
|
+
conninfo = make_conninfo(conn_string)
|
56
59
|
|
57
60
|
session_pool = AsyncConnectionPool(
|
58
|
-
conninfo=
|
61
|
+
conninfo=conninfo,
|
59
62
|
min_size=min_connections,
|
60
|
-
max_size=max_connections
|
63
|
+
max_size=max_connections
|
61
64
|
)
|
62
|
-
await session_pool.open()
|
63
65
|
return session_pool
|
64
66
|
|
65
67
|
|
@@ -319,6 +321,7 @@ class AsyncPostgresConnection(object):
|
|
319
321
|
|
320
322
|
self._session_pool = await _async_connect_warehouse(self._username, self._password, self._hostname, self._port,
|
321
323
|
self._database, self.min_connections, self.max_connections)
|
324
|
+
await self._session_pool.open()
|
322
325
|
|
323
326
|
async def set_user(self, credentials_dict: dict) -> None:
|
324
327
|
"""
|
@@ -413,6 +416,7 @@ class AsyncPostgresConnection(object):
|
|
413
416
|
|
414
417
|
async with self._session_pool.connection() as connection:
|
415
418
|
cursor = connection.cursor()
|
419
|
+
# await cursor.execute("set datestyle = 'SQL, DMY'")
|
416
420
|
if packed_data:
|
417
421
|
await cursor.execute(query, packed_data)
|
418
422
|
else:
|
@@ -16,8 +16,8 @@ wcp_library/logging.py,sha256=e6gG7HFgUrMajUZs4Gs0atFfOJJmdmxN0GerfynNWlY,2061
|
|
16
16
|
wcp_library/selenium_helper.py,sha256=w8YUC0pq7TkWiobc2ri4QR5fcHrrZgB5RAEfAdxZiuk,3780
|
17
17
|
wcp_library/sql/__init__.py,sha256=s2psmwkq_ZU23iGWvXjJrLu0hD1fB6CDv6RHcK7y828,1917
|
18
18
|
wcp_library/sql/oracle.py,sha256=TGiTC5L5UcM5QcHFajgn43NI8HygOGIEAtLmLbVFp2I,15772
|
19
|
-
wcp_library/sql/postgres.py,sha256=
|
19
|
+
wcp_library/sql/postgres.py,sha256=hyvENlOMyE1vcfPIy94KvtD67lCs5c4BMCKJbbIHNEY,14812
|
20
20
|
wcp_library/time.py,sha256=ktSzhK7SZnGPNXobFexnhFGQAcriLCJQKxnO0fed8fQ,1740
|
21
|
-
wcp_library-1.3.
|
22
|
-
wcp_library-1.3.
|
23
|
-
wcp_library-1.3.
|
21
|
+
wcp_library-1.3.9.dist-info/METADATA,sha256=8pXOreCzBh0TyYAKe_zSRIMHkl0eEQWCvbJn76HupCA,1552
|
22
|
+
wcp_library-1.3.9.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
23
|
+
wcp_library-1.3.9.dist-info/RECORD,,
|
File without changes
|