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


##########
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:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Redundant session.add_all call</b></div>
   <div id="fix">
   
   The explicit `db.session.add_all(metrics)` is semantically dead code. 
SQLAlchemy's `cascade="all"` includes save-update cascade, which automatically 
persists child `SqlMetric` objects when `db.session.add(table)` is called on 
line 128. This creates inconsistent treatment compared to how `columns` is 
handled on line 124, which correctly relies solely on cascade. Remove this line 
to maintain consistency and reflect correct understanding of ORM behavior.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #5f6135</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



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