bito-code-review[bot] commented on code in PR #41917:
URL: https://github.com/apache/superset/pull/41917#discussion_r3555908300
##########
tests/integration_tests/conftest.py:
##########
@@ -407,11 +409,12 @@ def physical_dataset():
yield dataset
- engine.execute(
- text("""
- DROP TABLE physical_dataset;
- """)
- )
+ with engine.begin() as conn:
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>CWE-674: Undefined Variable in Teardown</b></div>
<div id="fix">
The teardown code at line 412 references `engine`, but `engine` is defined
inside a `with` block (lines 357-388) that exits before the `yield` statement
at line 410. This causes `NameError: name 'engine' is not defined` when the
fixture is torn down. (See also:
[CWE-674](https://cwe.mitre.org/data/definitions/674.html))
</div>
</div>
<small><i>Code Review Run #73866c</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
##########
superset/db_engine_specs/snowflake.py:
##########
@@ -265,12 +265,13 @@ def get_catalog_names(
In Snowflake, a catalog is called a "database".
"""
- return {
- catalog
- for (catalog,) in inspector.bind.execute(
- text("SELECT DATABASE_NAME from information_schema.databases")
- )
- }
+ with inspector.bind.connect() as conn:
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Invalid attribute on Inspector</b></div>
<div id="fix">
Line 268 uses `inspector.bind.connect()` but SQLAlchemy's `Inspector` class
only has an `engine` attribute, not `bind`. This will raise `AttributeError:
'Inspector' object has no attribute 'bind'` at runtime. All other engine specs
(postgres, presto, databricks, etc.) consistently use
`inspector.engine.connect()` as seen in postgres.py:785.
</div>
</div>
<small><i>Code Review Run #73866c</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]