Skip to content

refactor: select in datasource_provider_service#34548

Merged
asukaminato0721 merged 2 commits intolanggenius:mainfrom
RenzoMXD:refactor/select-datasource-provider-service
Apr 5, 2026
Merged

refactor: select in datasource_provider_service#34548
asukaminato0721 merged 2 commits intolanggenius:mainfrom
RenzoMXD:refactor/select-datasource-provider-service

Conversation

@RenzoMXD
Copy link
Copy Markdown
Contributor

@RenzoMXD RenzoMXD commented Apr 4, 2026

Summary

  • Migrate all 6 db.session.query() calls to SQLAlchemy 2.x select() style in datasource_provider_service.py
  • Replace .filter_by().count() with db.session.scalar(select(func.count()).where())
  • Replace .filter_by().first() with db.session.scalar(select().where().limit(1))
  • Replace .where().all() with list(db.session.scalars(select().where()).all())
  • Add default scalar/scalars return values to test fixture for compatibility
  • Update 10 test mocks for affected methods only; other tests unchanged

Test plan

  • All 63 unit tests pass for datasource_provider_service
  • Basedpyright type check passes (0 errors)

Part of #22668

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. refactor labels Apr 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 4, 2026

Pyrefly Diff

No changes detected.

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Apr 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 4, 2026

Pyrefly Diff

No changes detected.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 5, 2026
@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 5, 2026
Merged via the queue into langgenius:main with commit 779e6b8 Apr 5, 2026
26 of 27 checks passed
@RenzoMXD RenzoMXD deleted the refactor/select-datasource-provider-service branch April 5, 2026 13:31
@RenzoMXD
Copy link
Copy Markdown
Contributor Author

RenzoMXD commented Apr 5, 2026

@asukaminato0721
I think this is the end for the @22668.
Pleas let me know if there is another issue for help.
Thanks.

HanqingZ pushed a commit to HanqingZ/dify that referenced this pull request Apr 23, 2026
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants