bito-code-review[bot] commented on code in PR #42221:
URL: https://github.com/apache/superset/pull/42221#discussion_r3616947035


##########
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 `db.session.add_all(metrics)` is technically 
correct if the `SqlMetric` relationship is configured with `cascade="all, 
delete-orphan"` or similar save-update cascades. In such cases, adding the 
parent `table` object to the session automatically persists the associated 
`metrics` collection, making the explicit `add_all` call redundant. Removing it 
improves consistency with how the `columns` collection is handled in the same 
function.
   
   **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]

Reply via email to