Repository navigation
Conversation
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Code Review Agent Run #8d1147
Actionable Suggestions - 3
-
pytest.ini - 1
- filterwarnings order prevents always directive · Line 29-30
-
superset/migrations/versions/2022-04-01_14-38_a9422eeaae74_new_dataset_models_take_2.py - 1
- Dead code introduced · Line 892-904
-
superset/db_engine_specs/gsheets.py - 1
- Loop variable overwritten by assignment · Line 409-411
Additional Suggestions - 1
-
pytest.ini - 1
-
Dead code: commented error directives · Line 32-47Lines 32-47 contain 16 commented-out `error:` directives for specific SQLAlchemy RemovedIn20Warning cases. Commented-out code that 'prevents regression' (per line 27) is dead code that cannot catch regressions. Either enable these directives or remove them to avoid confusion.
-
Filtered by Review Rules
Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
-
tests/integration_tests/datasource_tests.py - 1
- Deprecated SQLAlchemy API usage · Line 65-86
-
superset/db_engine_specs/snowflake.py - 1
- Inconsistent SQL wrapping pattern · Line 268-273
-
superset/extensions/metadb.py - 1
- Missing import for text() · Line 85-85
-
tests/unit_tests/db_engine_specs/test_trino.py - 1
- Naming inconsistency + call verification · Line 580-584
Review Details
-
Files reviewed - 39 · Commit Range:
26b7357..4bf3630- pytest.ini
- scripts/benchmark_migration.py
- superset/db_engine_specs/databricks.py
- superset/db_engine_specs/doris.py
- superset/db_engine_specs/duckdb.py
- superset/db_engine_specs/gsheets.py
- superset/db_engine_specs/hive.py
- superset/db_engine_specs/impala.py
- superset/db_engine_specs/postgres.py
- superset/db_engine_specs/presto.py
- superset/db_engine_specs/snowflake.py
- superset/db_engine_specs/starrocks.py
- superset/extensions/metadb.py
- superset/initialization/__init__.py
- superset/migrations/shared/utils.py
- superset/migrations/versions/2018-03-30_14-00_d6ffdf31bdd4_add_published_column_to_dashboards.py
- superset/migrations/versions/2022-04-01_14-38_a9422eeaae74_new_dataset_models_take_2.py
- superset/migrations/versions/2022-07-07_13-00_c747c78868b6_migrating_legacy_treemap.py
- superset/migrations/versions/2022-07-19_15-16_a39867932713_query_context_to_mediumtext.py
- superset/migrations/versions/2023-03-29_20-30_07f9a902af1b_drop_postgres_enum_constrains_for_tags.py
- superset/migrations/versions/2023-06-08_10-22_4c5da39be729_migrate_treemap_chart.py
- superset/utils/encrypt.py
- superset/utils/mock_data.py
- tests/example_data/data_loading/pandas/pandas_data_loader.py
- tests/integration_tests/celery_tests.py
- tests/integration_tests/conftest.py
- tests/integration_tests/databases/commands/upload_test.py
- tests/integration_tests/datasets/api_tests.py
- tests/integration_tests/datasets/commands_tests.py
- tests/integration_tests/datasource_tests.py
- tests/integration_tests/fixtures/energy_dashboard.py
- tests/integration_tests/fixtures/unicode_dashboard.py
- tests/integration_tests/fixtures/world_bank_dashboard.py
- tests/integration_tests/reports/commands_tests.py
- tests/integration_tests/sqllab_tests.py
- tests/unit_tests/db_engine_specs/test_doris.py
- tests/unit_tests/db_engine_specs/test_sqlite.py
- tests/unit_tests/db_engine_specs/test_trino.py
- tests/unit_tests/extensions/test_sqlalchemy.py
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].
Documentation & Help
| ignore | ||
| always::sqlalchemy.exc.RemovedIn20Warning |
There was a problem hiding this comment.
The bare ignore directive on line 29 will suppress all warnings before the always::sqlalchemy.exc.RemovedIn20Warning directive on line 30 can match them. Per pytest's filterwarnings behavior, the first matching directive wins. This means the 'always' directive is effectively dead code — RemovedIn20Warning messages will be silently ignored instead of being printed.
Code suggestion
Check the AI-generated fix before applying
--- pytest.ini (lines 25-31) ---
25: +# `ignore` virtually reproduces to `-p no:warnings`.
26: +# Always print RemovedIn20Warning when SQLALCHEMY_WARN_20=1.
27: +# Additionally, raise errors for refactored RemovedIn20Warning cases to prevent regression.
28: +filterwarnings =
29: + always::sqlalchemy.exc.RemovedIn20Warning
30: + ignore
31: + error:Passing a string to Connection.execute\(\) is deprecated:sqlalchemy.exc.RemovedIn20Warning
Code Review Run #8d1147
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #40277 +/- ##
==========================================
- Coverage 64.31% 64.27% -0.04%
==========================================
Files 2651 2652 +1
Lines 144773 144997 +224
Branches 33407 33456 +49
==========================================
+ Hits 93111 93202 +91
- Misses 49992 50110 +118
- Partials 1670 1685 +15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4bf3630 to
e63e7cc
Compare
|
Rebased and force-pushed e63e7cc in order to resolve merge conflict. |
There was a problem hiding this comment.
Code Review Agent Run #d38cb5
Actionable Suggestions - 5
-
superset/migrations/versions/2022-04-01_14-38_a9422eeaae74_new_dataset_models_take_2.py - 1
- CWE-89: SQL Parameter Binding Table Name · Line 892-904
-
tests/integration_tests/conftest.py - 1
- Duplicate with_feature_flags decorator · Line 222-222
-
superset/db_engine_specs/databricks.py - 1
- Duplicate adjust_engine_params method · Line 749-749
-
superset/db_engine_specs/hive.py - 1
- Test assertion mismatch · Line 237-237
-
pytest.ini - 1
- Dead code: commented-out rules · Line 32-47
Additional Suggestions - 2
-
superset/db_engine_specs/presto.py - 1
-
SQL injection pattern · Line 707-707The `text(f"SHOW COLUMNS FROM {full_table_name}")` embeds identifiers via f-string interpolation. While `quote_table` provides quoting protection, this pattern is flagged by bandit S608 and differs from SQLAlchemy's recommended parameterized approach.
-
-
pytest.ini - 1
-
Misleading comment about env var · Line 26-26Misleading documentation: Comment references `SQLALCHEMY_WARN_20=1` environment variable, but grep search shows this variable is not used anywhere in the codebase. This creates false expectations about warning behavior.
-
Filtered by Review Rules
Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
-
tests/integration_tests/conftest.py - 1
- Incomplete SQLAlchemy 2.0 migration · Line 150-157
-
tests/example_data/data_loading/pandas/pandas_data_loader.py - 1
- CWE-89: SQL Injection in f-string · Line 78-78
-
superset/extensions/metadb.py - 1
- CWE-758: text() used without import · Line 85-85
Review Details
-
Files reviewed - 39 · Commit Range:
3915b73..e63e7cc- pytest.ini
- scripts/benchmark_migration.py
- superset/db_engine_specs/databricks.py
- superset/db_engine_specs/doris.py
- superset/db_engine_specs/duckdb.py
- superset/db_engine_specs/gsheets.py
- superset/db_engine_specs/hive.py
- superset/db_engine_specs/impala.py
- superset/db_engine_specs/postgres.py
- superset/db_engine_specs/presto.py
- superset/db_engine_specs/snowflake.py
- superset/db_engine_specs/starrocks.py
- superset/extensions/metadb.py
- superset/initialization/__init__.py
- superset/migrations/shared/utils.py
- superset/migrations/versions/2018-03-30_14-00_d6ffdf31bdd4_add_published_column_to_dashboards.py
- superset/migrations/versions/2022-04-01_14-38_a9422eeaae74_new_dataset_models_take_2.py
- superset/migrations/versions/2022-07-07_13-00_c747c78868b6_migrating_legacy_treemap.py
- superset/migrations/versions/2022-07-19_15-16_a39867932713_query_context_to_mediumtext.py
- superset/migrations/versions/2023-03-29_20-30_07f9a902af1b_drop_postgres_enum_constrains_for_tags.py
- superset/migrations/versions/2023-06-08_10-22_4c5da39be729_migrate_treemap_chart.py
- superset/utils/encrypt.py
- superset/utils/mock_data.py
- tests/example_data/data_loading/pandas/pandas_data_loader.py
- tests/integration_tests/celery_tests.py
- tests/integration_tests/conftest.py
- tests/integration_tests/databases/commands/upload_test.py
- tests/integration_tests/datasets/api_tests.py
- tests/integration_tests/datasets/commands_tests.py
- tests/integration_tests/datasource_tests.py
- tests/integration_tests/fixtures/energy_dashboard.py
- tests/integration_tests/fixtures/unicode_dashboard.py
- tests/integration_tests/fixtures/world_bank_dashboard.py
- tests/integration_tests/reports/commands_tests.py
- tests/integration_tests/sqllab_tests.py
- tests/unit_tests/db_engine_specs/test_doris.py
- tests/unit_tests/db_engine_specs/test_sqlite.py
- tests/unit_tests/db_engine_specs/test_trino.py
- tests/unit_tests/extensions/test_sqlalchemy.py
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].
Documentation & Help
| schema=table.schema, | ||
| ) as engine: | ||
| engine.execute(f"DROP TABLE IF EXISTS {str(table)}") | ||
| engine.execute(text(f"DROP TABLE IF EXISTS {str(table)}")) |
There was a problem hiding this comment.
In tests/integration_tests/db_engine_specs/hive_tests.py, import text from SQLAlchemy and change the two mock_execute.assert_any_call(f"DROP TABLE IF EXISTS …") assertions to mock_execute.assert_any_call(text(f"DROP TABLE IF EXISTS …")) so they match the code change.
Code suggestion
Check the AI-generated fix before applying
--- a/superset/db_engine_specs/hive.py
+++ b/superset/db_engine_specs/hive.py
@@ -237 +237 @@
-mock_execute.assert_any_call(f"DROP TABLE IF EXISTS {table_name}")
+mock_execute.assert_any_call(text(f"DROP TABLE IF EXISTS {table_name}"))
Code Review Run #d38cb5
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
e63e7cc to
cb4b4e5
Compare
There was a problem hiding this comment.
Code Review Agent Run #3d1d0b
Actionable Suggestions - 2
-
superset/migrations/versions/2022-04-01_14-38_a9422eeaae74_new_dataset_models_take_2.py - 1
- CWE-89: SQL Identifier Binding Error · Line 874-886
-
tests/integration_tests/sqllab_tests.py - 1
- SQLAlchemy engine.execute deprecated · Line 187-189
Additional Suggestions - 2
-
superset/utils/encrypt.py - 1
-
CWE-89: SQL Injection Pattern Unfixed · Line 305-305The `text()` wrapper does not prevent SQL injection here — string interpolation still occurs before `text()` is called. The `# noqa: S608` comment suppresses a real Bandit warning without fixing the underlying pattern. However, `table_name` and column names originate from internal ORM metadata (`discover_encrypted_fields()`), not user input, so actual exploitability is low. Consider using SQLAlchemy's `quoted_name()` or programmatic query building instead.
-
-
tests/integration_tests/datasets/commands_tests.py - 1
-
Inconsistent text() usage within file · Line 618-647The diff wraps SQL strings with `text()` in `test_create_dataset_command` (lines 621, 623, 644) but leaves identical raw string patterns unchanged in `test_export_dataset_command_unicode_chars` (lines 282, 283, 310) in the same file. This creates divergence risk and maintenance inconsistency.
-
Filtered by Review Rules
Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
-
tests/unit_tests/db_engine_specs/test_doris.py - 3
- Semantic duplication in test helpers · Line 283-288
- Missing type hints in helper function · Line 283-286
- Missing docstring in helper function · Line 283-288
Review Details
-
Files reviewed - 39 · Commit Range:
6d07078..cb4b4e5- pytest.ini
- scripts/benchmark_migration.py
- superset/db_engine_specs/databricks.py
- superset/db_engine_specs/doris.py
- superset/db_engine_specs/duckdb.py
- superset/db_engine_specs/gsheets.py
- superset/db_engine_specs/hive.py
- superset/db_engine_specs/impala.py
- superset/db_engine_specs/postgres.py
- superset/db_engine_specs/presto.py
- superset/db_engine_specs/snowflake.py
- superset/db_engine_specs/starrocks.py
- superset/extensions/metadb.py
- superset/initialization/__init__.py
- superset/migrations/shared/utils.py
- superset/migrations/versions/2018-03-30_14-00_d6ffdf31bdd4_add_published_column_to_dashboards.py
- superset/migrations/versions/2022-04-01_14-38_a9422eeaae74_new_dataset_models_take_2.py
- superset/migrations/versions/2022-07-07_13-00_c747c78868b6_migrating_legacy_treemap.py
- superset/migrations/versions/2022-07-19_15-16_a39867932713_query_context_to_mediumtext.py
- superset/migrations/versions/2023-03-29_20-30_07f9a902af1b_drop_postgres_enum_constrains_for_tags.py
- superset/migrations/versions/2023-06-08_10-22_4c5da39be729_migrate_treemap_chart.py
- superset/utils/encrypt.py
- superset/utils/mock_data.py
- tests/example_data/data_loading/pandas/pandas_data_loader.py
- tests/integration_tests/celery_tests.py
- tests/integration_tests/conftest.py
- tests/integration_tests/databases/commands/upload_test.py
- tests/integration_tests/datasets/api_tests.py
- tests/integration_tests/datasets/commands_tests.py
- tests/integration_tests/datasource_tests.py
- tests/integration_tests/fixtures/energy_dashboard.py
- tests/integration_tests/fixtures/unicode_dashboard.py
- tests/integration_tests/fixtures/world_bank_dashboard.py
- tests/integration_tests/reports/commands_tests.py
- tests/integration_tests/sqllab_tests.py
- tests/unit_tests/db_engine_specs/test_doris.py
- tests/unit_tests/db_engine_specs/test_sqlite.py
- tests/unit_tests/db_engine_specs/test_trino.py
- tests/unit_tests/extensions/test_sqlalchemy.py
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].
Documentation & Help
|
9f8e279 fixes broken integration tests, which I were not able to run locally. |
Code Review Agent Run #e42af5Actionable Suggestions - 0Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
rusackas
left a comment
There was a problem hiding this comment.
LGTM! One tiny thing before I merge: the assert_*_with_text helper is copy-pasted into presto/doris/trino/hive test files. Might be worth pulling into a shared test util so we're not maintaining four copies. Happy to take it as a follow-up rather than block on it, or you can tackle it here if you have the time.
@rusackas Thanks for the feedback. I have learnt about DAMP tests the other day. But DRY is fine by me, too. 5859ecb places the assertion helpers into a shared module. Hope this will do. |
|
Thanks again! This is all coming along nicely :D |
|
Bito Automatic Review Skipped – PR Already Merged |
See #40273 .
Depends on #40274 .
SUMMARY
Enable errors for deprecated Connection.execute() syntax, and fix them all.
In addition to fixing all broken tests, I manually went through all results of
git grep execute(.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION