Skip to content

Commit

Permalink
Merge pull request #406 from NannyML/fix/py37-pydantic-compatibility
Browse files Browse the repository at this point in the history
Fix pydantic compatibility with python 3.7
  • Loading branch information
nnansters authored Jul 10, 2024
2 parents c87abfe + b14c503 commit 7b6db6f
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit 7b6db6f

Please sign in to comment.