bito-code-review[bot] commented on PR #43921:
URL: https://github.com/apache/superset/pull/43921#issuecomment-5549525077
<!-- Bito Reply -->
The flagged issue is correct. When a physical column is dropped, the
`TableColumn` row remains in the database because it is not explicitly removed,
and the `SqlaTable.changed_on` timestamp is not updated, causing cached charts
to rely on stale schema metadata.
The provided PR diff already implements a fix for this in
`superset/connectors/sqla/models.py` by forcing a `changed_on` update when
physical columns are dropped:
```python
# Child TableColumn rows own the FK, so mutating them (and
reassigning
# ``self.columns``) does not emit an UPDATE on this tables row.
# AuditMixinNullable.changed_on onupdate therefore never fires, and
# query_cache_key() keeps serving results computed against the
previous
# column definitions. Force the same bump DatasetDAO.update() applies
# when columns are saved. See #43918.
dropped_physical_columns = any(not col.expression for col in
leftover_columns)
if results.added or results.modified or dropped_physical_columns:
self.changed_on = datetime.now()
```
This change ensures that any schema drift—whether additions, modifications,
or deletions of physical columns—correctly invalidates the cache by updating
the `changed_on` timestamp.
**superset/connectors/sqla/models.py**
```
dropped_physical_columns = any(not col.expression for col in
leftover_columns)
if results.added or results.modified or dropped_physical_columns:
self.changed_on = datetime.now()
```
--
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]