wcp-library 1.3.7__tar.gz → 1.3.9__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.
Files changed (23) hide show
  1. {wcp_library-1.3.7 → wcp_library-1.3.9}/PKG-INFO +1 -1
  2. {wcp_library-1.3.7 → wcp_library-1.3.9}/pyproject.toml +1 -1
  3. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/sql/postgres.py +12 -8
  4. {wcp_library-1.3.7 → wcp_library-1.3.9}/README.md +0 -0
  5. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/__init__.py +0 -0
  6. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/credentials/__init__.py +0 -0
  7. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/credentials/_credential_manager_asynchronous.py +0 -0
  8. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/credentials/_credential_manager_synchronous.py +0 -0
  9. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/credentials/api.py +0 -0
  10. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/credentials/ftp.py +0 -0
  11. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/credentials/internet.py +0 -0
  12. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/credentials/oracle.py +0 -0
  13. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/credentials/postgres.py +0 -0
  14. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/emailing.py +0 -0
  15. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/ftp/__init__.py +0 -0
  16. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/ftp/ftp.py +0 -0
  17. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/ftp/sftp.py +0 -0
  18. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/informatica.py +0 -0
  19. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/logging.py +0 -0
  20. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/selenium_helper.py +0 -0
  21. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/sql/__init__.py +0 -0
  22. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/sql/oracle.py +0 -0
  23. {wcp_library-1.3.7 → wcp_library-1.3.9}/wcp_library/time.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wcp-library
3
- Version: 1.3.7
3
+ Version: 1.3.9
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "wcp-library"
3
- version = "1.3.7"
3
+ version = "1.3.9"
4
4
  description = "Common utilites for internal development at WCP"
5
5
  authors = ["Mitch-Petersen <mitch.petersen@wcap.ca>"]
6
6
  readme = "README.md"
@@ -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
- url = f"postgres://{username}:{password}@{hostname}:{port}/{database}"
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=url,
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
- url = f"postgres://{username}:{password}@{hostname}:{port}/{database}"
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=url,
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
 
@@ -317,8 +319,9 @@ class AsyncPostgresConnection(object):
317
319
  :return: None
318
320
  """
319
321
 
320
- self._session_pool = await _connect_warehouse(self._username, self._password, self._hostname, self._port,
321
- self._database, self.min_connections, self.max_connections)
322
+ self._session_pool = await _async_connect_warehouse(self._username, self._password, self._hostname, self._port,
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:
File without changes