codeant-ai-for-open-source[bot] commented on code in PR #44805:
URL: https://github.com/apache/superset/pull/44805#discussion_r4136553799
##########
superset/db_engine_specs/sqlite.py:
##########
@@ -164,8 +164,19 @@ def get_temporal_column_shift_expr(
def convert_dttm(
cls, target_type: str, dttm: datetime, db_extra: dict[str, Any] | None
= None
) -> str | None:
+ """
+ Write midnight as a bare date for DATE columns.
+
+ SQLite has no date type, so a DATE column usually holds text such as
+ ``2026-09-20`` and is compared as text. ``'2026-09-20 00:00:00'`` sorts
+ after the day it starts, so a time filter on a DATE column would be
one day
+ off. Any other time keeps its time part, which sorts between two days,
as a
+ comparison of dates should.
+ """
sqla_type = cls.get_sqla_column_type(target_type)
- if isinstance(sqla_type, (types.String, types.DateTime)):
+ if isinstance(sqla_type, types.Date) and dttm.time() == time.min:
+ return f"'{dttm.date().isoformat()}'"
+ if isinstance(sqla_type, (types.String, types.Date, types.DateTime)):
return f"""'{dttm.isoformat(sep=" ", timespec="seconds")}'"""
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> For SQLite DATE conversions, do not require honoring column-specific date
formats in convert_dttm; it intentionally only receives the type name and
normalizes DATE values, while custom-format support is handled separately.
**Applied to:**
- `superset/db_engine_specs/sqlite.py`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]