From b71c9296234f680116e3b76e2ff8fc04a65f9eca Mon Sep 17 00:00:00 2001 From: Zack Ganger Date: Tue, 8 Oct 2024 19:56:59 -0400 Subject: [PATCH] rely on psycopg rather than psycopg2 --- backend/scraper/notebooks/cpdp.ipynb | 4 ++-- backend/scraper/notebooks/mpv.ipynb | 1 - requirements/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/scraper/notebooks/cpdp.ipynb b/backend/scraper/notebooks/cpdp.ipynb index ab889c14b..84870651d 100644 --- a/backend/scraper/notebooks/cpdp.ipynb +++ b/backend/scraper/notebooks/cpdp.ipynb @@ -72,7 +72,7 @@ "import numpy as np\n", "import pandas as pd\n", "import sqlalchemy\n", - "import psycopg2\n", + "import psycopg\n", "from IPython.display import display, HTML\n", "from collections import namedtuple\n", "from backend.database import db, Incident, Officer, Accusation, Victim\n", @@ -350,7 +350,7 @@ " try:\n", " insert_bulk(dicts, OrmClass)\n", " except sqlalchemy.exc.IntegrityError as e:\n", - " if isinstance(e.orig, psycopg2.errors.UniqueViolation):\n", + " if isinstance(e.orig, psycopg.errors.UniqueViolation):\n", " print(f\"Already created {OrmClass.__name__} records\")\n", " else:\n", " raise e\n", diff --git a/backend/scraper/notebooks/mpv.ipynb b/backend/scraper/notebooks/mpv.ipynb index 793121844..b8a85db95 100644 --- a/backend/scraper/notebooks/mpv.ipynb +++ b/backend/scraper/notebooks/mpv.ipynb @@ -89,7 +89,6 @@ "import numpy as np\n", "import pandas as pd\n", "from flask_sqlalchemy import SQLAlchemy\n", - "import psycopg2\n", "from itertools import zip_longest\n", "from typing import List\n", "import requests\n", diff --git a/requirements/Dockerfile b/requirements/Dockerfile index c032d156c..266aab74b 100644 --- a/requirements/Dockerfile +++ b/requirements/Dockerfile @@ -1,4 +1,4 @@ -# psycopg2 requires postgres development files in order to compile the +# psycopg requires postgres development files in order to compile the # requirements, so this image starts with the same image as the database # containers and installs the same version of python as the api containers