Fix unknown options for psycopg2 startup
Some checks failed
ci/woodpecker/push/check Pipeline failed

This commit is contained in:
PapaTutuWawa 2025-04-21 17:27:28 +02:00
parent 0596c99bea
commit d7616e33a1
3 changed files with 6 additions and 5 deletions

View File

@ -5,7 +5,7 @@ ADD . /app
RUN apk add --no-cache cargo git libpq libpq-dev && \ RUN apk add --no-cache cargo git libpq libpq-dev && \
uv sync --frozen --no-install-project --no-dev --extra postgres uv sync --frozen --no-install-project --no-dev --extra postgres
RUN --mount=type=cache,target=/root/.cache/uv \ RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev uv sync --frozen --no-dev --extra postgres
FROM python:3.13-alpine3.20 FROM python:3.13-alpine3.20
# slixmpp requires libgcc and libpq for Postgres support # slixmpp requires libgcc and libpq for Postgres support

View File

@ -1,5 +1,5 @@
import os import os
from typing import Annotated, Self, cast from typing import Annotated, Any, Self, cast
import logging import logging
from pydantic import BaseModel, Field, model_validator from pydantic import BaseModel, Field, model_validator
@ -53,6 +53,9 @@ class _DatabaseConfig(BaseModel):
# The file to read the database URI from # The file to read the database URI from
uri_file: str | None = Field(default=None) uri_file: str | None = Field(default=None)
# sqlalchemy options for the database connection
connect_args: dict[str, Any] = Field(default_factory=dict)
@model_validator(mode="after") @model_validator(mode="after")
def validate_secret(self) -> Self: def validate_secret(self) -> Self:
if self.uri_plain is None and self.uri_file is None: if self.uri_plain is None and self.uri_file is None:

View File

@ -12,9 +12,7 @@ from xmpp_api.db.bot import Bot, AllowedJid
def get_engine(config: ConfigDep) -> Engine: def get_engine(config: ConfigDep) -> Engine:
return create_engine( return create_engine(
config.database.uri, config.database.uri,
connect_args={ connect_args=config.database.connect_args,
"check_same_thread": False,
},
) )