Skip to content

chore: session enforce sqlalchemy 2.0 - #42365

Merged
rusackas merged 4 commits into
apache:masterfrom
hy144328:refactor/sqlalchemy-migration-future-session
Jul 27, 2026
Merged

chore: session enforce sqlalchemy 2.0#42365
rusackas merged 4 commits into
apache:masterfrom
hy144328:refactor/sqlalchemy-migration-future-session

Conversation

@hy144328

Copy link
Copy Markdown
Contributor

See #40273 .

SUMMARY

Enforce SQLAlchemy ORM 2.0.
This includes setting future=True on all calls to sessionmaker() and Session().
In theory, this should also cover the session objects inside Flask Appbuilder because they are exposed to the Superset codebase as factory methods (SessionMaker objects are callable) that accept future arguments.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

Unit tests:

SQLALCHEMY_WARN_20=1 python3 -m pytest tests/unit_tests/

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot Bot added the change:backend Requires changing the backend label Jul 23, 2026
@bito-code-review

bito-code-review Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #c83a74

Actionable Suggestions - 0
Additional Suggestions - 2
  • superset/migrations/versions/2020-08-12_00-24_978245563a02_migrate_iframe_to_dash_markdown.py - 1
    • SQLAlchemy 2.0 future parameter · Line 92-92
      When Superset upgrades to SQLAlchemy 2.0, the `future=True` parameter must be removed from this session. It was a forward-compatibility flag in 1.4 and was removed in 2.0 since 2.0 behavior becomes the default. Schedule a follow-up task to clean this up during the SQLAlchemy 2.0 migration.
  • superset/tags/models.py - 1
    • Duplicated session creation pattern · Line 238-238
      The `Session(bind=connection, future=True)` pattern appears 6 times in the diff with identical syntax. Since the module-level `Session` at line 52 already includes `future=True`, each of these calls could potentially be simplified to `Session(bind=connection)`.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/migrations/versions/2018-06-07_09-52_afb7730f6a9c_remove_empty_filters.py - 1
    • Remove deprecated future=True from Session · Line 48-48
  • superset/migrations/versions/2023-06-08_10-22_4c5da39be729_migrate_treemap_chart.py - 1
    • SQLAlchemy version compatibility regression · Line 48-48
  • superset/migrations/versions/2021-04-09_16-14_085f06488938_country_map_use_lowercase_country_name.py - 2
    • SQLAlchemy future=True removal risk · Line 52-52
    • SQLAlchemy future=True removal risk · Line 72-72
  • superset/migrations/versions/2022-08-16_15-23_6d3c6f9d665d_fix_table_chart_conditional_formatting_.py - 1
    • Missing type annotation on Session · Line 48-48
  • superset/commands/streaming_export/base.py - 1
  • superset/migrations/versions/2019-07-15_12-00_190188938582_adding_unique_constraint_on_dashboard_slices_tbl.py - 1
  • superset/migrations/versions/2024-04-26_12-36_4a33124c18ad_mig_new_columnar_upload_perm.py - 1
    • Inconsistent error handling in downgrade · Line 77-81
Review Details
  • Files reviewed - 132 · Commit Range: 845715f..845715f
    • superset/commands/streaming_export/base.py
    • superset/migrations/shared/catalogs.py
    • superset/migrations/versions/2016-04-25_08-54_c3a8f8611885_materializing_permission.py
    • superset/migrations/versions/2016-06-07_12-33_d8bc074f7aad_add_new_field_is_restricted_to_.py
    • superset/migrations/versions/2016-06-27_08-43_27ae655e4247_make_creator_owners.py
    • superset/migrations/versions/2016-09-07_23-50_33d996bcc382_update_slice_model.py
    • superset/migrations/versions/2016-09-22_11-31_eca4694defa7_sqllab_setting_defaults.py
    • superset/migrations/versions/2017-01-24_12-31_db0c65b146bd_update_slice_model_json.py
    • superset/migrations/versions/2017-02-08_14-16_a99f2f7c195a_rewriting_url_from_shortner_with_new_.py
    • superset/migrations/versions/2017-12-08_08-19_67a6ac9b727b_update_spatial_params.py
    • superset/migrations/versions/2017-12-17_11-06_21e88bc06c02_annotation_migration.py
    • superset/migrations/versions/2018-02-13_08-07_e866bd2d4976_smaller_grid.py
    • superset/migrations/versions/2018-04-03_08-19_130915240929_is_sqllab_viz_flow.py
    • superset/migrations/versions/2018-04-10_11-19_bf706ae5eb46_cal_heatmap_metric_to_metrics.py
    • superset/migrations/versions/2018-06-04_11-12_c5756bec8b47_time_grain_sqla.py
    • superset/migrations/versions/2018-06-07_09-52_afb7730f6a9c_remove_empty_filters.py
    • superset/migrations/versions/2018-06-13_10-20_4451805bbaa1_remove_double_percents.py
    • superset/migrations/versions/2018-06-13_14-54_bddc498dd179_adhoc_filters.py
    • superset/migrations/versions/2018-06-14_14-31_80a67c5192fa_single_pie_chart_metric.py
    • superset/migrations/versions/2018-07-05_15-19_3dda56f1c4c6_migrate_num_period_compare_and_period_.py
    • superset/migrations/versions/2018-07-19_23-41_c617da68de7d_form_nullable.py
    • superset/migrations/versions/2018-07-20_15-31_7f2635b51f5d_update_base_columns.py
    • superset/migrations/versions/2018-07-20_15-57_e9df189e5c7e_update_base_metrics.py
    • superset/migrations/versions/2018-07-22_11-59_bebcf3fed1fe_convert_dashboard_v1_positions.py
    • superset/migrations/versions/2018-08-01_11-47_7fcdcde0761c_.py
    • superset/migrations/versions/2018-11-12_13-31_4ce8df208545_migrate_time_range_for_default_filters.py
    • superset/migrations/versions/2018-12-11_22-03_fb13d49b72f9_better_filters.py
    • superset/migrations/versions/2018-12-15_12-34_3e1b21cd94a4_change_owner_to_m2m_relation_on_.py
    • superset/migrations/versions/2019-03-21_10-22_d94d33dbe938_form_strip.py
    • superset/migrations/versions/2019-04-09_16-27_80aa3f04bc82_add_parent_ids_in_dashboard_layout.py
    • superset/migrations/versions/2019-06-28_13-17_ab8c66efdd01_resample.py
    • superset/migrations/versions/2019-07-15_12-00_190188938582_adding_unique_constraint_on_dashboard_slices_tbl.py
    • superset/migrations/versions/2019-09-11_21-49_5afa9079866a_serialize_schema_permissions_py.py
    • superset/migrations/versions/2019-09-19_13-40_258b5280a45e_form_strip_leading_and_trailing_whitespace.py
    • superset/migrations/versions/2019-10-10_13-52_1495eb914ad3_time_range.py
    • superset/migrations/versions/2019-11-06_15-23_78ee127d0d1d_reconvert_legacy_filters_into_adhoc.py
    • superset/migrations/versions/2020-02-07_14-13_3325d4caccc8_dashboard_scoped_filters.py
    • superset/migrations/versions/2020-03-25_10-42_f9a30386bd74_cleanup_time_grainularity.py
    • superset/migrations/versions/2020-04-29_09-24_620241d1153f_update_time_grain_sqla.py
    • superset/migrations/versions/2020-08-12_00-24_978245563a02_migrate_iframe_to_dash_markdown.py
    • superset/migrations/versions/2020-09-24_12-04_3fbbc6e8d654_fix_data_access_permissions_for_virtual_.py
    • superset/migrations/versions/2020-09-28_17-57_b56500de1855_add_uuid_column_to_import_mixin.py
    • superset/migrations/versions/2020-10-05_18-10_af30ca79208f_collapse_alerting_models_into_a_single_.py
    • superset/migrations/versions/2020-10-21_21-09_96e99fb176a0_add_import_mixing_to_saved_query.py
    • superset/migrations/versions/2020-11-20_14-24_e38177dbf641_security_converge_saved_queries.py
    • superset/migrations/versions/2020-11-30_15-25_40f16acf1ba7_security_converge_reports.py
    • superset/migrations/versions/2020-11-30_17-54_8ee129739cf9_security_converge_css_templates.py
    • superset/migrations/versions/2020-12-09_14-13_ccb74baaa89b_security_converge_charts.py
    • superset/migrations/versions/2020-12-10_15-05_45731db65d9c_security_converge_datasets.py
    • superset/migrations/versions/2020-12-11_11-45_1f6dca87d1a2_security_converge_dashboards.py
    • superset/migrations/versions/2020-12-11_17-02_c25cb2c78727_security_converge_annotations.py
    • superset/migrations/versions/2020-12-14_10-49_42b4c9e01447_security_converge_databases.py
    • superset/migrations/versions/2020-12-14_13-40_4b84f97828aa_security_converge_logs.py
    • superset/migrations/versions/2020-12-16_12-15_e37912a26567_security_converge_queries.py
    • superset/migrations/versions/2021-01-23_16-25_260bf0649a77_migrate_x_dateunit_in_time_range.py
    • superset/migrations/versions/2021-02-04_09-34_070c043f2fdb_add_granularity_to_charts_where_missing.py
    • superset/migrations/versions/2021-02-10_12-32_41ce8799acc3_rename_pie_label_type.py
    • superset/migrations/versions/2021-02-14_11-46_1412ec1e5a7b_legacy_force_directed_to_echart.py
    • superset/migrations/versions/2021-02-18_09-13_c501b7c653a3_add_missing_uuid_column.py
    • superset/migrations/versions/2021-03-24_09-47_989bbe479899_rename_filter_configuration_in_.py
    • superset/migrations/versions/2021-04-07_07-21_134cea61c5e7_remove_dataset_health_check_message.py
    • superset/migrations/versions/2021-04-09_16-14_085f06488938_country_map_use_lowercase_country_name.py
    • superset/migrations/versions/2021-04-12_12-38_fc3a3a8ff221_migrate_filter_sets_to_new_format.py
    • superset/migrations/versions/2021-04-29_15-32_f1410ed7ec95_migrate_native_filters_to_new_schema.py
    • superset/migrations/versions/2021-08-02_16-39_e323605f370a_fix_schemas_allowed_for_csv_upload.py
    • superset/migrations/versions/2021-08-03_15-36_143b6f2815da_migrate_pivot_table_v2_heatmaps_to_new_.py
    • superset/migrations/versions/2021-08-04_17-16_f6196627326f_update_chart_permissions.py
    • superset/migrations/versions/2021-08-09_17-32_07071313dd52_change_fetch_values_predicate_to_text.py
    • superset/migrations/versions/2021-08-31_11-37_021b81fe4fbb_add_type_to_native_filter_configuration.py
    • superset/migrations/versions/2021-09-27_11-31_60dc453f4e2e_migrate_timeseries_limit_metric_to_.py
    • superset/migrations/versions/2021-10-12_11-15_32646df09c64_update_time_grain_sqla.py
    • superset/migrations/versions/2021-11-11_04-18_0ca9e5f1dacd_rename_to_schemas_allowed_for_file_.py
    • superset/migrations/versions/2021-12-10_19-25_bb38f40aa3ff_add_force_screenshot_to_alerts_reports.py
    • superset/migrations/versions/2021-12-13_14-06_fe23025b9441_rename_big_viz_total_form_data_fields.py
    • superset/migrations/versions/2021-12-17_16-56_31bb738bd1d2_move_pivot_table_v2_legacy_order_by_to_.py
    • superset/migrations/versions/2022-03-02_09-20_b5a422d8e252_fix_query_and_saved_query_null_schema.py
    • superset/migrations/versions/2022-03-02_16-41_7293b0ca7944_change_adhoc_filter_b_from_none_to_.py
    • superset/migrations/versions/2022-04-01_14-38_a9422eeaae74_new_dataset_models_take_2.py
    • superset/migrations/versions/2022-04-04_15-04_b0d0249074e4_deprecate_time_range_endpoints_v2.py
    • superset/migrations/versions/2022-04-18_11-20_ad07e4fdbaba_rm_time_range_endpoints_from_qc_3.py
    • superset/migrations/versions/2022-05-03_19-39_cbe71abde154_fix_report_schedule_and_log.py
    • superset/migrations/versions/2022-05-18_16-07_e786798587de_delete_none_permissions.py
    • superset/migrations/versions/2022-06-19_16-17_f3afaf1f11f0_add_unique_name_desc_rls.py
    • superset/migrations/versions/2022-06-27_14-59_7fb8bca906d2_permalink_rename_filterstate.py
    • superset/migrations/versions/2022-07-05_15-48_409c7b420ab0_add_created_by_fk_as_owner.py
    • superset/migrations/versions/2022-07-07_13-00_c747c78868b6_migrating_legacy_treemap.py
    • superset/migrations/versions/2022-07-07_14-00_06e1e70058c7_migrating_legacy_area.py
    • superset/migrations/versions/2022-08-16_15-23_6d3c6f9d665d_fix_table_chart_conditional_formatting_.py
    • superset/migrations/versions/2022-11-28_17-51_4ce1d9b25135_remove_filter_bar_orientation.py
    • superset/migrations/versions/2023-02-28_14-46_c0a3ea245b61_remove_show_native_filters.py
    • superset/migrations/versions/2023-03-05_10-06_d0ac08bb5b83_invert_horizontal_bar_chart_order.py
    • superset/migrations/versions/2023-03-17_13-24_b5ea9d343307_bar_chart_stack_options.py
    • superset/migrations/versions/2023-03-27_12-30_7e67aecbf3f1_chart_ds_constraint.py
    • superset/migrations/versions/2023-05-01_12-03_9c2a5681ddfd_convert_key_value_entries_to_json.py
    • superset/migrations/versions/2023-05-11_12-41_4ea966691069_cross_filter_global_scoping.py
    • superset/migrations/versions/2023-06-08_09-02_9ba2ce3086e5_migrate_pivot_table_v1_to_v2.py
    • superset/migrations/versions/2023-06-08_10-22_4c5da39be729_migrate_treemap_chart.py
    • superset/migrations/versions/2023-06-08_11-34_ae58e1e58e5c_migrate_dual_line_to_mixed_chart.py
    • superset/migrations/versions/2023-07-18_15-30_863adcf72773_delete_obsolete_druid_nosql_slice_parameters.py
    • superset/migrations/versions/2023-07-19_16-48_a23c6f8b1280_cleanup_erroneous_parent_filter_ids.py
    • superset/migrations/versions/2023-07-19_17-54_ee179a490af9_deckgl_path_width_units.py
    • superset/migrations/versions/2023-08-02_15-23_0769ef90fddd_fix_schema_perm_for_datasets.py
    • superset/migrations/versions/2023-08-14_09-38_9f4a086c2676_add_normalize_columns_to_sqla_model.py
    • superset/migrations/versions/2023-09-06_13-18_317970b4400c_added_time_secondary_column_to_.py
    • superset/migrations/versions/2023-12-15_17-58_06dd9ff00fe8_add_percent_calculation_type_funnel_.py
    • superset/migrations/versions/2024-01-18_14-41_a32e0c4d8646_migrate_sunburst_chart.py
    • superset/migrations/versions/2024-01-18_15-20_214f580d09c9_migrate_filter_boxes_to_native_filters.py
    • superset/migrations/versions/2024-02-07_17-13_87d38ad83218_migrate_can_view_and_drill_permission.py
    • superset/migrations/versions/2024-03-01_10-47_be1b217cd8cd_big_number_kpi_single_metric.py
    • superset/migrations/versions/2024-04-08_15-43_5ad7321c2169_mig_new_csv_upload_perm.py
    • superset/migrations/versions/2024-04-17_14-04_d60591c5515f_mig_new_excel_upload_perm.py
    • superset/migrations/versions/2024-04-26_12-36_4a33124c18ad_mig_new_columnar_upload_perm.py
    • superset/migrations/versions/2024-05-10_18-02_f84fde59123a_update_charts_with_old_time_comparison.py
    • superset/migrations/versions/2025-01-08_09-34_d482d51c15ca_remove_legacy_plugins_5_0.py
    • superset/migrations/versions/2025-01-22_14-34_74ad1125881c_converge_upload_permissions.py
    • superset/migrations/versions/2025-04-13_22-10_378cecfdba9f_merge_x_axis_sort_series_with_x_axis_.py
    • superset/migrations/versions/2025-06-06_00-39_363a9b1e8992_convert_metric_currencies_from_str_to_json.py
    • superset/migrations/versions/2025-12-16_12-00_f5b5f88d8526_fix_form_data_string_in_query_context.py
    • superset/migrations/versions/2026-03-02_00-00_ce6bd21901ab_migrate_deckgl_and_mapbox.py
    • superset/migrations/versions/2026-03-02_12-00_a1b2c3d4e5f6_add_granular_export_permissions.py
    • superset/migrations/versions/2026-05-29_00-00_b4a3f2e1d0c9_fix_security_view_menu_case.py
    • superset/migrations/versions/2026-06-23_03-23_a7d3f1b9c2e4_cleanup_stale_can_import_pvm.py
    • superset/migrations/versions/2026-06-30_00-00_d24e6b0a9c7f_strip_metricsqlexpressions_from_ag_grid_params.py
    • superset/tags/models.py
    • tests/integration_tests/dao/conftest.py
    • tests/unit_tests/conftest.py
    • tests/unit_tests/databases/filters_test.py
    • tests/unit_tests/distributed_lock/distributed_lock_tests.py
    • tests/unit_tests/migrations/test_strip_metricsqlexpressions_from_ag_grid_params.py
    • tests/unit_tests/security/exclude_users_filter_test.py
    • tests/unit_tests/versioning/test_listener.py
    • tests/unit_tests/views/test_soft_delete_filter.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added the risk:db-migration PRs that require a DB migration label Jul 23, 2026
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.34%. Comparing base (206fe7a) to head (3b2b24c).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
superset/migrations/shared/catalogs.py 0.00% 2 Missing ⚠️
superset/commands/streaming_export/base.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42365      +/-   ##
==========================================
+ Coverage   65.25%   65.34%   +0.09%     
==========================================
  Files        2794     2799       +5     
  Lines      157396   158022     +626     
  Branches    35982    35982              
==========================================
+ Hits       102706   103267     +561     
- Misses      52713    52778      +65     
  Partials     1977     1977              
Flag Coverage Δ
hive 38.42% <25.00%> (ø)
javascript 71.23% <ø> (-0.01%) ⬇️
mysql 57.63% <25.00%> (ø)
postgres 57.67% <25.00%> (ø)
presto 40.35% <25.00%> (ø)
python 59.08% <25.00%> (ø)
sqlite 57.29% <25.00%> (ø)
superset-extensions-cli 90.57% <ø> (?)
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hy144328
hy144328 marked this pull request as draft July 23, 2026 23:24
…list

The pylint hook declares exclude: ^(...|superset/migrations/|...) but its
inline script recomputes the file list from git diff, which bypassed that
exclusion. Pylint's ignore=migrations setting in .pylintrc also does not
apply to files passed explicitly on the command line, so touching
migration files (which legitimately call session.commit()) tripped W9001
consider-using-transaction.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hy144328

Copy link
Copy Markdown
Contributor Author

Converting to draft for now.
Unit and integration tests pass.
However, pre-commit hook fails, all PyLint W9001, although it did not trigger when I made the commit.
It mostly affect the migration scripts.
They explicitly commit to the session whereas PyLint seems to prefer transaction context managers.
This is also happened with #42277 , and was fixed by b0bb20f.
Applying the same fix to all the migration scripts now.

@rusackas

Copy link
Copy Markdown
Member

Thanks @hy144328! The pre-commit failure wasn't yours... the pylint hook was pulling migration files into its lint list even though they're meant to be excluded, and migrations legitimately call session.commit(). Pushed a one-line fix to the hook config, so hopefully CI goes green now 🤞

@rusackas

Copy link
Copy Markdown
Member

Not sure if this is the right approach... sorry if I'm meddling too much, just say the word.

@hy144328

Copy link
Copy Markdown
Contributor Author

Thanks @hy144328! The pre-commit failure wasn't yours... the pylint hook was pulling migration files into its lint list even though they're meant to be excluded, and migrations legitimately call session.commit(). Pushed a one-line fix to the hook config, so hopefully CI goes green now 🤞

OK! Thanks for the quick reply! Saved me a ton of work here.

This said, as I have just mentioned, I refactored one migration script yesterday in #42277 . Hope that this is not a problem. b0bb20f

@hy144328

Copy link
Copy Markdown
Contributor Author

Not sure if this is the right approach... sorry if I'm meddling too much, just say the word.

Not at all, I really appreciate it. Potentially saved me a ton of work here. Technically speaking, I would have been open to refactoring from explicit commit to context managers. I guess now is as good a time as ever since this PR already touches over 100 files, including the migration scripts. 😅

@rusackas

Copy link
Copy Markdown
Member

@hy144328 DM me on slack... might be more expedient at times than chatting here ;)

@hy144328
hy144328 marked this pull request as ready for review July 23, 2026 23:59
@rusackas
rusackas self-requested a review July 24, 2026 00:00

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The diff is fully mechanical (all 203 changed lines are exact future=True twins of what they replace, no logic changes), and I poked at the scary part locally: on 1.4.54, a future session bound to a connection with an open transaction seems to commit and roll back just like a legacy one, so the downgrade() paths should behave the same as before.

One thing worth a glance, though not blocking. db.session(future=True) in the streaming export raises if a scoped session already exists on the thread. The current call path is fine since the generator runs after teardown, but it would bite if anyone ever wraps that response in stream_with_context. Bito's note about the redundant future=True in tags/models.py (the sessionmaker already sets it) is also legit if you feel like trimming it.

@rusackas

Copy link
Copy Markdown
Member

Capturing the follow-up work from the side discussion, since I'd rather keep this PR mechanical and easy to review than grow it.

Adopting with session.begin(): as the house style for new migrations seems like the obvious first step, basically what you already did in #42277.

Converting the back catalog is optional and separable: the trailing-commit and try/commit/except/rollback shapes convert cleanly, but the loop/batch commits change failure semantics, so I'd leave those alone unless there's a concrete reason to touch one.

Then there's deciding whether to lint migrations for real instead of excluding them. That would need a migration-appropriate message (there's no @transaction decorator in alembic-land), a consistent trigger (migration-only PRs currently skip the hook entirely), and a plan for paginated_update, which commits mid-generator.

Happy to open issues for these if there's appetite. Thanks again for the PR!

@hy144328

Copy link
Copy Markdown
Contributor Author

Bito's note about the redundant future=True in tags/models.py (the sessionmaker already sets it) is also legit if you feel like trimming it.

That is right. I thought about it when grepping sessionmaker(, and forgot about it when grepping Session( after all those migration scripts. Will do so immediately.

@hy144328

Copy link
Copy Markdown
Contributor Author

db.session(future=True) in the streaming export raises if a scoped session already exists on the thread. The current call path is fine since the generator runs after teardown, but it would bite if anyone ever wraps that response in stream_with_context.

I have to think about this one a little more (tomorrow). Where I do not quite follow: How is this related to setting future.

As you described correctly, I was quite mechanical about this PR. I did not notice any existing transactions being affected by this. I was also not able to find stream_with_context.

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hy144328! The master merge dismissed my earlier stamp, and dropping the per-call future=True looks good since the sessionmaker already sets it. Still LGTM.

@rusackas

Copy link
Copy Markdown
Member

Just need a codeowner stamp here due to all the migrations. Perhaps @betodealmeida, @eschutho, @michael-s-molina, @mistercrunch, and/or @sadpandajoe can take a looksee?

@bito-code-review

bito-code-review Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #03d2d6

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 845715f..3b2b24c
    • .pre-commit-config.yaml
    • superset/tags/models.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas
rusackas merged commit 8f8331f into apache:master Jul 27, 2026
67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:backend Requires changing the backend risk:db-migration PRs that require a DB migration size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants