Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pydantic compatibility with python 3.7 #406

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions nannyml/io/db/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
its results into a specific table.
"""

import sys

from datetime import datetime
from typing import List, Optional

Expand Down Expand Up @@ -46,7 +48,8 @@ class Run(SQLModel, table=True): # type: ignore[call-arg]
# Ignore clash of `model_id` field name with default protected namespace `model_`
# See: https://github.com/pydantic/pydantic/discussions/7121
# Better solution using `alias` is not possible due to SQLModel issue
model_config = ConfigDict(protected_namespaces=())
if sys.version_info >= (3, 8):
model_config = ConfigDict(protected_namespaces=()) # type: ignore

#: Foreign key in all ``metric`` tables
id: Optional[int] = Field(default=None, primary_key=True)
Expand All @@ -70,7 +73,8 @@ class Metric(SQLModel):
# Ignore clash of `model_id` field name with default protected namespace `model_`
# See: https://github.com/pydantic/pydantic/discussions/7121
# Better solution using `alias` is not possible due to SQLModel issue
model_config = ConfigDict(protected_namespaces=())
if sys.version_info >= (3, 8):
model_config = ConfigDict(protected_namespaces=()) # type: ignore

#: The technical identifier for this database row
id: Optional[int] = Field(default=None, primary_key=True)
Expand Down
Loading