Skip to content

Commit

Permalink
Merge pull request #26 from adriangb/main
Browse files Browse the repository at this point in the history
Update Pydantic to v2
  • Loading branch information
jwills committed Jan 18, 2024
2 parents 5017e3a + ede37d2 commit 37ed325
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 10 additions & 9 deletions buenavista/http/schemas.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any, Dict, List, Optional


from pydantic import BaseModel, HttpUrl
from pydantic import BaseModel, ConfigDict, HttpUrl


def camel_case(s: str) -> str:
Expand All @@ -10,9 +10,10 @@ def camel_case(s: str) -> str:


class CamelModel(BaseModel):
class Config:
alias_generator = camel_case
allow_population_by_field_name = True
model_config = ConfigDict(
alias_generator=camel_case,
populate_by_name=True,
)


class ClientTypeSignatureParameter(CamelModel):
Expand Down Expand Up @@ -57,11 +58,11 @@ class StatementStats(CamelModel):


class QueryError(CamelModel):
message: Optional[str]
sql_state: Optional[str]
message: Optional[str] = None
sql_state: Optional[str] = None
error_code: int
error_name: Optional[str]
error_type: Optional[str]
error_name: Optional[str] = None
error_type: Optional[str] = None
retriable: bool
error_location: Optional[CamelModel] = None
failure_info: Optional[CamelModel] = None
Expand All @@ -81,7 +82,7 @@ class BaseResult(CamelModel):
id: str
info_uri: HttpUrl
stats: StatementStats
warnings: Optional[List[PrestoWarning]]
warnings: Optional[List[PrestoWarning]] = None


class QueryResult(BaseResult):
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
packages=find_namespace_packages(include=["buenavista", "buenavista.*"]),
include_package_data=True,
install_requires=[
"fastapi>=0.80.0,<1.0.0",
"pydantic>=1.2.0,<2.0.0",
"fastapi>=0.109.0,<1.0.0",
"pydantic>=2,<3",
"sqlglot",
],
extras_require={
Expand Down

0 comments on commit 37ed325

Please sign in to comment.