Discussed in #12010
Originally posted by hsanslavillepro July 29, 2026
Trino row condition binds Python datetime as VARCHAR
Hi everyone,
I am using Great Expectations with Trino and a TableAsset.
When I use a Python datetime in a row_condition, the value is sent to Trino as a VARCHAR instead of a TIMESTAMP.
Environment
- Great Expectations:
1.18.2
- Python:
3.11
- Database: Trino
- Expectation:
ExpectTableRowCountToBeBetween
Code
from datetime import datetime
import great_expectations as gx
from great_expectations.expectations.row_conditions import Column
min_allowed_datetime = datetime.now()
row_condition = (
Column("date_insertion_clean")
>= min_allowed_datetime
)
expectation = gx.expectations.ExpectTableRowCountToBeBetween(
min_value=0,
max_value=100,
row_condition=row_condition,
)
The Trino column is:
date_insertion_clean TIMESTAMP(3)
Error
TrinoUserError(
type=USER_ERROR,
name=TYPE_MISMATCH,
message="Cannot apply operator: timestamp(3) <= varchar(26)"
)
The generated SQL contains:
WHERE date_insertion_clean >= ?
The parameter is:
'2026-07-27T12:16:25.146982'
Although I pass a Python datetime, the parameter appears to be serialized and bound as a VARCHAR.
Expected behavior
The parameter should be bound as a SQL TIMESTAMP, or the generated SQL should use an explicit cast:
WHERE date_insertion_clean >= CAST(? AS TIMESTAMP)
Questions
- Is this a known issue with Trino row conditions?
- Is it fixed in Great Expectations
1.19.1 or a later version?
- Is there a supported way to specify the SQL type or apply a
CAST in a row_condition?
Thank you for your time ⌚ 🐛 🙏
Discussed in #12010
Originally posted by hsanslavillepro July 29, 2026
Trino row condition binds Python
datetimeasVARCHARHi everyone,
I am using Great Expectations with Trino and a
TableAsset.When I use a Python
datetimein arow_condition, the value is sent to Trino as aVARCHARinstead of aTIMESTAMP.Environment
1.18.23.11ExpectTableRowCountToBeBetweenCode
The Trino column is:
Error
The generated SQL contains:
The parameter is:
Although I pass a Python
datetime, the parameter appears to be serialized and bound as aVARCHAR.Expected behavior
The parameter should be bound as a SQL
TIMESTAMP, or the generated SQL should use an explicit cast:Questions
1.19.1or a later version?CASTin arow_condition?Thank you for your time ⌚ 🐛 🙏