diff --git a/indexer_worker/indexer_worker/db_helpers.py b/indexer_worker/indexer_worker/db_helpers.py index 6d8ea76e7f9..e0074dd01a3 100644 --- a/indexer_worker/indexer_worker/db_helpers.py +++ b/indexer_worker/indexer_worker/db_helpers.py @@ -2,7 +2,7 @@ import time from typing import NamedTuple -import psycopg2 +import psycopg from decouple import config @@ -43,10 +43,10 @@ def database_connect( """ while True: try: - conn = psycopg2.connect(**dbconfig._asdict(), connect_timeout=timeout) + conn = psycopg.connect(**dbconfig._asdict(), connect_timeout=timeout) if autocommit: conn.set_session(autocommit=True) - except psycopg2.OperationalError as e: + except psycopg.OperationalError as e: if not attempt_reconnect: return None log.exception(e) diff --git a/indexer_worker/indexer_worker/queries.py b/indexer_worker/indexer_worker/queries.py index 9f6eae56dda..cb57ef77982 100644 --- a/indexer_worker/indexer_worker/queries.py +++ b/indexer_worker/indexer_worker/queries.py @@ -1,4 +1,4 @@ -from psycopg2.sql import SQL, Identifier, Literal +from psycopg.sql import SQL, Identifier, Literal def get_existence_queries(model_name: str, table_name: str) -> tuple[SQL, SQL]: