Skip to content

Commit ed84e15

Browse files
yuvanistjoel@joellee.org
authored andcommitted
Migrate postgrest-py from pydantic v1 to v2. (#276)
* Update package to pydantic 2.1 * Update poetry.lock * Specify pydantic minor version * isort fix * Update poetry lock * lock hash update
1 parent 29d378e commit ed84e15

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

poetry.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

postgrest/base_request_builder.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from httpx import Headers, QueryParams
2020
from httpx import Response as RequestResponse
21-
from pydantic import BaseModel, validator
21+
from pydantic import BaseModel, field_validator
2222

2323
from .types import CountMethod, Filters, RequestMethod, ReturnMethod
2424
from .utils import AsyncClient, SyncClient, sanitize_param
@@ -113,7 +113,7 @@ class APIResponse(BaseModel):
113113
count: Optional[int] = None
114114
"""The number of rows returned."""
115115

116-
@validator("data")
116+
@field_validator("data")
117117
@classmethod
118118
def raise_when_api_error(cls: Type[APIResponse], value: Any) -> Any:
119119
if isinstance(value, dict) and value.get("message"):

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ packages = [
2121
python = "^3.8"
2222
httpx = "^0.24.0"
2323
deprecation = "^2.1.0"
24-
pydantic = ">=1.9,<3.0"
24+
pydantic = ">=2.1.0,<3.0"
2525
strenum = "^0.4.9"
2626

2727
[tool.poetry.dev-dependencies]

0 commit comments

Comments
 (0)