From 55052097602be0b502338821d75f5c3510146e6d Mon Sep 17 00:00:00 2001 From: Adrien Date: Sun, 7 May 2023 11:24:02 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Replace=20asyncpg=20with?= =?UTF-8?q?=20psycopg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/main.py | 12 ++++++++++-- backend/pyproject.toml | 5 ++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/backend/main.py b/backend/main.py index 85b2623..8ed0e9b 100755 --- a/backend/main.py +++ b/backend/main.py @@ -45,8 +45,16 @@ MODE = environ.get("MODE", "grpc") COLLECTOR_ENDPOINT_GRPC_ENDPOINT = environ.get( "COLLECTOR_ENDPOINT_GRPC_ENDPOINT", "127.0.0.1:14250" # "jaeger-collector:14250" ) -# TODO: Remove postgresql+asyncpg from environ variable -DB_PATH = "postgresql+asyncpg://cer_user:cer_password@127.0.0.1:5438/cer_db" + +# CREATE DATABASE "carrramba-encore-rate"; +# CREATE USER cer WITH ENCRYPTED PASSWORD 'cer_password'; +# GRANT ALL PRIVILEGES ON DATABASE "carrramba-encore-rate" TO cer; +# \c "carrramba-encore-rate"; +# GRANT ALL ON schema public TO cer; +# CREATE EXTENSION IF NOT EXISTS pg_trgm; + +# TODO: Remove postgresql+psycopg from environ variable +DB_PATH = "postgresql+psycopg://cer:cer_password@127.0.0.1:5432/carrramba-encore-rate" app = FastAPI() diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 3194b2a..200d8a4 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -11,10 +11,8 @@ python = "^3.11" aiohttp = "^3.8.3" rich = "^12.6.0" aiofiles = "^22.1.0" -sqlalchemy = {extras = ["asyncio"], version = "^2.0.1"} fastapi = "^0.88.0" uvicorn = "^0.20.0" -asyncpg = "^0.27.0" msgspec = "^0.12.0" pyshp = "^2.3.1" pyproj = "^3.5.0" @@ -25,6 +23,8 @@ opentelemetry-sdk = "^1.17.0" opentelemetry-api = "^1.17.0" opentelemetry-exporter-otlp-proto-http = "^1.17.0" opentelemetry-instrumentation-sqlalchemy = "^0.38b0" +sqlalchemy = "^2.0.12" +psycopg = "^3.1.9" [build-system] requires = ["poetry-core"] @@ -46,7 +46,6 @@ autopep8 = "^2.0.1" pyflakes = "^3.0.1" yapf = "^0.32.0" whatthepatch = "^1.0.4" -sqlalchemy = {extras = ["mypy"], version = "^2.0.1"} mypy = "^1.0.0" [tool.mypy]