Skip to content
Snippets Groups Projects
Commit 7fc7a5ce authored by Tim Repke's avatar Tim Repke
Browse files

fix build

parent eb308493
No related branches found
No related tags found
1 merge request!53OpenAlex Search and pydantic v2 migration
Pipeline #1864 passed
...@@ -60,11 +60,11 @@ class DatabaseConfig(BaseModel): ...@@ -60,11 +60,11 @@ class DatabaseConfig(BaseModel):
CONNECTION_STR: PostgresDsn | None = None CONNECTION_STR: PostgresDsn | None = None
@field_validator('CONNECTION_STR', mode='before') @field_validator('CONNECTION_STR', mode='before')
def build_connection_string(cls, v: str | None, info: FieldValidationInfo) -> str: def build_connection_string(cls, v: str | None, info: FieldValidationInfo) -> PostgresDsn:
assert info.config is not None assert info.config is not None
if isinstance(v, str): if isinstance(v, str):
return v raise ValueError('This field will be generated automatically, please do not use it.')
return PostgresDsn.build( return PostgresDsn.build(
scheme=info.data.get('SCHEME', 'postgresql'), scheme=info.data.get('SCHEME', 'postgresql'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment