aminghadersohi opened a new pull request, #44695:
URL: https://github.com/apache/superset/pull/44695
### SUMMARY
Two Google Sheets engine spec fixes, both reproduced against a live
spreadsheet with a service account:
1. **`validate_parameters` rejects valid sheets for service accounts without
domain-wide delegation.** It always passed the logged-in user's e-mail as
`subject`, so Google refused the token (`invalid_grant` /
`unauthorized_client`) and every catalog URL was reported as "The URL could not
be identified". It now sets `subject` only when the database has
`impersonate_user` enabled, which is also when queries impersonate the user
(`impersonate_user()`).
2. **`df_to_sql` crashes on date/datetime (and Decimal) columns.**
`df.fillna("").values.tolist()` keeps `pd.Timestamp` / `datetime.date` objects,
so posting the values raised `TypeError: Object of type date is not JSON
serializable`. With `if_exists="replace"` this happened after the target sheet
had been cleared. Cells are now converted to JSON values first (ISO strings for
dates, which `USER_ENTERED` parses back as dates; Python scalars for numpy
values; strings for `Decimal`).
### TESTING INSTRUCTIONS
- `pytest tests/unit_tests/db_engine_specs/test_gsheets.py` (new tests fail
without the change).
- Live: service-account connection, impersonation off → both valid URLs
validate; CSV upload with a date column into an existing catalog entry →
uploaded and read back as typed dates.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] 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]