Skip to content

Instantly share code, notes, and snippets.

@marcusmotill
Created August 17, 2022 20:04
Show Gist options
  • Save marcusmotill/8029ffad116680bc43c07f610204f738 to your computer and use it in GitHub Desktop.
Save marcusmotill/8029ffad116680bc43c07f610204f738 to your computer and use it in GitHub Desktop.
--- a/forecast_api/storage/postgres_connection.py
+++ b/forecast_api/storage/postgres_connection.py
@@ -1,7 +1,7 @@
import contextlib
import logging
-import psycopg2
+import pg8000.dbapi
logger = logging.getLogger(__name__)
@@ -23,10 +23,10 @@ class PostgresConnection(object):
def _connect(self):
logger.info("Connecting to database host: %s", self._database_url.host)
- self._conn = psycopg2.connect(
+ self._conn = pg8000.dbapi.connect(
host=self._database_url.host,
port=self._database_url.port,
- dbname=self._database_url.database,
+ database=self._database_url.database,
user=self._database_url.user,
password=self._database_url.password
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment