Skip to content

Commit 8b4b95b

Browse files
committed
Replace psycopg2-binary with pg8000
psycopg2 is licensed under LGPL that's not compatible with ASF - https://www.apache.org/legal/resolved.html#category-x
1 parent 5c0b480 commit 8b4b95b

File tree

3 files changed

+40
-15
lines changed

3 files changed

+40
-15
lines changed

hunter/postgres.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from datetime import datetime
33
from typing import Dict
44

5-
import psycopg2
5+
import pg8000
66

77
from hunter.analysis import ChangePoint
88
from hunter.test_config import PostgresTestConfig
@@ -29,9 +29,9 @@ class Postgres:
2929
def __init__(self, config: PostgresConfig):
3030
self.__config = config
3131

32-
def __get_conn(self) -> psycopg2.extensions.connection:
32+
def __get_conn(self) -> pg8000.dbapi.Connection:
3333
if self.__conn is None:
34-
self.__conn = psycopg2.connect(
34+
self.__conn = pg8000.dbapi.Connection(
3535
host=self.__config.hostname,
3636
port=self.__config.port,
3737
user=self.__config.username,
@@ -43,7 +43,7 @@ def __get_conn(self) -> psycopg2.extensions.connection:
4343
def fetch_data(self, query: str):
4444
cursor = self.__get_conn().cursor()
4545
cursor.execute(query)
46-
columns = [c.name for c in cursor.description]
46+
columns = [c[0] for c in cursor.description]
4747
return (columns, cursor.fetchall())
4848

4949
def insert_change_point(

poetry.lock

+35-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ expandvars = "^0.6.5"
1010
numpy = "1.24"
1111
python = ">=3.8,<3.13"
1212
python-dateutil = "^2.8.1"
13-
psycopg2-binary = "^2.9.3"
1413
signal-processing-algorithms = "^1.3.2"
1514
"ruamel.yaml" = "=0.17.21"
1615
requests = "^2.25.1"
@@ -19,6 +18,7 @@ tabulate = "^0.8.7"
1918
validators = "^0.18.2"
2019
slack-sdk = "^3.4.2"
2120
google-cloud-bigquery = "^3.25.0"
21+
pg8000 = "^1.31.2"
2222

2323

2424
[tool.poetry.dev-dependencies]

0 commit comments

Comments
 (0)