bito-code-review[bot] commented on code in PR #40494:
URL: https://github.com/apache/superset/pull/40494#discussion_r3344832393
##########
superset/daos/dataset.py:
##########
@@ -424,6 +424,27 @@ def get_table_by_name(database_id: int, table_name: str)
-> SqlaTable | None:
.one_or_none()
)
+ @staticmethod
+ def get_table_by_catalog_schema_and_name(
+ database_id: int,
+ schema: str | None,
+ table_name: str,
+ catalog: str | None = None,
+ ) -> SqlaTable | None:
+ # Filter by the full ``(database_id, catalog, schema, table_name)``
+ # uniqueness key so callers can disambiguate datasets that share a
+ # ``table_name`` across schemas or catalogs (#30377).
+ return (
+ db.session.query(SqlaTable)
+ .filter_by(
+ database_id=database_id,
+ catalog=catalog,
+ schema=schema,
+ table_name=table_name,
+ )
+ .one_or_none()
+ )
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing unit tests for new method</b></div>
<div id="fix">
The new `get_table_by_catalog_schema_and_name` method lacks unit tests. Per
BITO.md rule [11730], new tools/features should include tests covering both
happy paths and edge cases. Existing `tests/unit_tests/dao/dataset_test.py`
provides a suitable location with `test_validate_update_uniqueness`
demonstrating the test pattern for `SqlaTable` uniqueness.
</div>
</div>
<small><i>Code Review Run #b10a0c</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]