Skip to content

Commit 637f7fa

Browse files
replaced pydantic.BaseModel by dataclasses.dataclass, pydantic no longer required
1 parent 6466f61 commit 637f7fa

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/dbally/context/context.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import ast
2+
from dataclasses import dataclass
23
from typing import Iterable
34

4-
from pydantic import BaseModel
55
from typing_extensions import Self, TypeAlias
66

77
from dbally.context.exceptions import ContextNotAvailableError
88

9-
# CustomContext = TypeVar('CustomContext', bound='BaseCallerContext', covariant=True)
109
CustomContext: TypeAlias = "BaseCallerContext"
1110

1211

13-
class BaseCallerContext(BaseModel):
12+
@dataclass
13+
class BaseCallerContext:
1414
"""
1515
Pydantic-based record class. Base class for contexts that are used to pass additional knowledge about
1616
the caller environment to the filters. It is not made abstract for the convinience of IQL parsing.

tests/unit/iql/test_iql_parser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
from dataclasses import dataclass
23
from typing import List, Union
34

45
import pytest
@@ -10,10 +11,12 @@
1011
from dbally.views.exposed_functions import ExposedFunction, MethodParamWithTyping
1112

1213

14+
@dataclass
1315
class TestCustomContext(BaseCallerContext):
1416
city: str
1517

1618

19+
@dataclass
1720
class AnotherTestCustomContext(BaseCallerContext):
1821
some_field: str
1922

tests/unit/views/test_sqlalchemy_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# pylint: disable=missing-docstring, missing-return-doc, missing-param-doc, disallowed-name
22

33
import re
4+
from dataclasses import dataclass
45
from typing import Union
56

67
import sqlalchemy
@@ -11,6 +12,7 @@
1112
from dbally.views.sqlalchemy_base import SqlAlchemyBaseView
1213

1314

15+
@dataclass
1416
class SomeTestContext(BaseCallerContext):
1517
age: int
1618

0 commit comments

Comments
 (0)