bito-code-review[bot] commented on code in PR #42221:
URL: https://github.com/apache/superset/pull/42221#discussion_r3623684302
##########
tests/integration_tests/datasets/api_tests.py:
##########
@@ -123,6 +123,7 @@ def insert_dataset(
if columns:
table.columns = columns
if metrics:
+ db.session.add_all(metrics)
Review Comment:
<!-- Bito Reply -->
The suggestion to remove the explicit `db.session.add_all(metrics)` call is
technically correct because the SQLAlchemy save-update cascade automatically
persists the associated `metrics` collection when the parent `table` object is
added to the session. While the current code is functionally harmless and
maintains consistency with the `columns` handling in the same function,
removing the redundant call is a cleaner approach that aligns with standard ORM
practices.
**tests/integration_tests/datasets/api_tests.py**
```
if columns:
table.columns = columns
if metrics:
db.session.add_all(metrics)
```
--
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]