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

   ### SUMMARY
   
   `SemanticLayer.semantic_views` was declared with a plain forward 
`list[SemanticView]` annotation, and SQLAlchemy mapped it with `uselist=False`. 
After a reload, a layer with two persisted views returned a single view, and 
iterating the relationship raised `TypeError: 'SemanticView' object is not 
iterable`.
   
   The relationship now sets `uselist=True` and `collection_class=list`. 
`cascade="all, delete-orphan"` and `passive_deletes=True` are unchanged, so 
delete behaviour is the same as before: when the views are loaded the ORM 
cascades to each one, and when they are not loaded the database `ON DELETE 
CASCADE` removes them (per-view ORM delete hooks do not run in that case, as 
before).
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A (model mapping).
   
   ### TESTING INSTRUCTIONS
   
   - `pytest tests/unit_tests/semantic_layers/models_test.py 
tests/unit_tests/semantic_layers/dao_test.py 
tests/unit_tests/commands/semantic_layer/delete_test.py`
   - The added SQLite cases persist a layer with two views, reload it, and 
assert both come back; they also delete the layer with the views loaded and 
unloaded. The reload and loaded-delete cases fail on master with the 
`TypeError` above.
   - Limit: the unloaded-delete case relies on `PRAGMA foreign_keys=ON` 
reaching the session through SQLite's shared in-memory connection; issuing it 
on the session's own connection would be more robust and is a possible 
follow-up.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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