Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 0 additions & 4 deletions airflow/serialization/pydantic/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class Config:
"""Make sure it deals automatically with SQLAlchemy ORM classes."""

from_attributes = True
orm_mode = True # Pydantic 1.x compatibility.


class TaskOutletDatasetReferencePydantic(BaseModelPydantic):
Expand All @@ -48,7 +47,6 @@ class Config:
"""Make sure it deals automatically with SQLAlchemy ORM classes."""

from_attributes = True
orm_mode = True # Pydantic 1.x compatibility.


class DatasetPydantic(BaseModelPydantic):
Expand All @@ -68,7 +66,6 @@ class Config:
"""Make sure it deals automatically with SQLAlchemy ORM classes."""

from_attributes = True
orm_mode = True # Pydantic 1.x compatibility.


class DatasetEventPydantic(BaseModelPydantic):
Expand All @@ -87,4 +84,3 @@ class Config:
"""Make sure it deals automatically with SQLAlchemy ORM classes."""

from_attributes = True
orm_mode = True # Pydantic 1.x compatibility.
1 change: 0 additions & 1 deletion airflow/serialization/pydantic/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ class Config:
"""Make sure it deals automatically with SQLAlchemy ORM classes."""

from_attributes = True
orm_mode = True # Pydantic 1.x compatibility.
1 change: 0 additions & 1 deletion airflow/serialization/pydantic/taskinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class Config:
"""Make sure it deals automatically with SQLAlchemy ORM classes."""

from_attributes = True
orm_mode = True # Pydantic 1.x compatibility.

def xcom_pull(
self,
Expand Down
5 changes: 1 addition & 4 deletions airflow/serialization/serialized_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,7 @@ def serialize(
elif use_pydantic_models and _ENABLE_AIP_44:

def _pydantic_model_dump(model_cls: type[BaseModel], var: Any) -> dict[str, Any]:
try:
return model_cls.model_validate(var).model_dump(mode="json") # type: ignore[attr-defined]
except AttributeError: # Pydantic 1.x compatibility.
return model_cls.from_orm(var).dict() # type: ignore[attr-defined]
return model_cls.model_validate(var).model_dump(mode="json")

if isinstance(var, Job):
return cls._encode(_pydantic_model_dump(JobPydantic, var), type_=DAT.BASE_JOB)
Expand Down