sadpandajoe opened a new pull request, #43355:
URL: https://github.com/apache/superset/pull/43355

   ### SUMMARY
   Filtering a Date-typed column on a Google Sheets-backed dataset (for 
example, a built-in "Previous Calendar Month" time range) raised `Invalid 
query: NO_COLUMN: null`. `GSheetsEngineSpec` inherited 
`SqliteEngineSpec.convert_dttm`, which only handles `String`/`DateTime` 
SQLAlchemy types and returns `None` for `Date`. Superset then fell back to a 
full `'YYYY-MM-DD HH:MM:SS.ffffff'` literal for the filter bound, even for a 
pure Date column. Shillelagh's `ISODate` parser (used internally by the GSheets 
adapter to turn the SQL literal into a filter value) rejects the trailing 
time-of-day and silently returns `None`, which the adapter then renders as the 
bare, unquoted literal `null` in the generated query. Google's API parses that 
bareword as a column reference rather than a NULL value, producing exactly the 
reported error.
   
   This adds a `GSheetsEngineSpec.convert_dttm` override that emits a plain 
`'YYYY-MM-DD'` literal for Date columns (no `TO_DATE()`-style wrapper needed, 
since shillelagh's query layer is SQLite/apsw, not Postgres), matching the 
format the adapter actually parses. DateTime columns are unaffected — they 
already go through the inherited, working code path.
   
   See `RCA.md` on this branch for the full root-cause trace, including a 
standalone reproduction script run against the installed `shillelagh` package 
before and after the fix.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A — backend query-generation fix, no UI change.
   
   ### TESTING INSTRUCTIONS
   - `pytest tests/unit_tests/db_engine_specs/test_gsheets.py -k 
test_convert_dttm` — new parametrized test covering Date, DateTime, and an 
unrecognized type. The Date case fails on `master` (`AssertionError: None`) and 
passes with this change.
   - Full `tests/unit_tests/db_engine_specs/` and 
`tests/unit_tests/models/helpers_test.py` suites pass with no new failures.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue: related to #30413 (same `NO_COLUMN: null` error 
reported for Google Sheets dashboard filters generally; this fixes the 
mechanism for Date-typed columns specifically)
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   


-- 
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]

Reply via email to