Skip to content

Commit ed9593f

Browse files
committed
fix error
1 parent 9df7634 commit ed9593f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

great_expectations/expectations/conditions.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,20 @@ class NullityCondition(Condition):
184184
column: Column
185185
is_null: bool
186186

187+
@validator("column", pre=True)
188+
@classmethod
189+
def _ensure_column_object(cls, v: Column | str | dict) -> Column:
190+
"""Convert column field to Column object if it's a string or dict.
191+
192+
This handles deserialization from GX Cloud where the column might be
193+
provided as a plain string or dict instead of a Column object.
194+
"""
195+
if isinstance(v, str):
196+
return Column(name=v)
197+
elif isinstance(v, dict):
198+
return Column(**v)
199+
return v # Already a Column object
200+
187201
@override
188202
def __repr__(self):
189203
null_str = "NULL" if self.is_null else "NOT NULL"
@@ -196,6 +210,20 @@ class ComparisonCondition(Condition):
196210
operator: Operator
197211
parameter: Parameter = Field(...)
198212

213+
@validator("column", pre=True)
214+
@classmethod
215+
def _ensure_column_object(cls, v: Column | str | dict) -> Column:
216+
"""Convert column field to Column object if it's a string or dict.
217+
218+
This handles deserialization from GX Cloud where the column might be
219+
provided as a plain string or dict instead of a Column object.
220+
"""
221+
if isinstance(v, str):
222+
return Column(name=v)
223+
elif isinstance(v, dict):
224+
return Column(**v)
225+
return v # Already a Column object
226+
199227
@root_validator
200228
def _validate_parameter_not_none(cls, values):
201229
parameter = values.get("parameter")

0 commit comments

Comments
 (0)