Skip to content

refactor: migrate session.query to select API in batch clean and disable segments tasks#34760

Merged
asukaminato0721 merged 1 commit intolanggenius:mainfrom
RenzoMXD:refactor/sqlalchemy-select-tasks-small-batch3
Apr 8, 2026
Merged

refactor: migrate session.query to select API in batch clean and disable segments tasks#34760
asukaminato0721 merged 1 commit intolanggenius:mainfrom
RenzoMXD:refactor/sqlalchemy-select-tasks-small-batch3

Conversation

@RenzoMXD
Copy link
Copy Markdown
Contributor

@RenzoMXD RenzoMXD commented Apr 8, 2026

Summary

  • Migrate session.query() to SQLAlchemy 2.0 select() API in 2 task files
  • tasks/batch_clean_document_task.py: query().where().delete()cast(CursorResult, session.execute(delete(...))) with proper type annotation
  • tasks/disable_segments_from_index_task.py: 2× .query().where().first()session.scalar(select(...).limit(1)), 1× .query().where().all()session.scalars(select(...)).all(), 1× .query().where().update()session.execute(update(...).values(...))

Test plan

  • All 158 task unit tests pass
  • basedpyright: 0 errors, 0 warnings
  • mypy: 0 errors

Part of #22668

@RenzoMXD RenzoMXD requested a review from JohnJyong as a code owner April 8, 2026 17:37
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. refactor labels Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

Pyrefly Diff

No changes detected.

@RenzoMXD RenzoMXD closed this Apr 8, 2026
@RenzoMXD RenzoMXD reopened this Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

Pyrefly Diff

No changes detected.

@RenzoMXD RenzoMXD closed this Apr 8, 2026
@RenzoMXD RenzoMXD reopened this Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

Pyrefly Diff

No changes detected.

@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 8, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 8, 2026
Merged via the queue into langgenius:main with commit 5821511 Apr 8, 2026
74 of 79 checks passed
@RenzoMXD RenzoMXD deleted the refactor/sqlalchemy-select-tasks-small-batch3 branch April 9, 2026 02:35
HanqingZ pushed a commit to HanqingZ/dify that referenced this pull request Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer refactor size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants