Skip to content

refactor: Change "filter" to "where" to match SQLAlchemy 2.x style.#22801

Merged
laipz8200 merged 15 commits intolanggenius:mainfrom
asukaminato0721:orm-select
Jul 23, 2025
Merged

refactor: Change "filter" to "where" to match SQLAlchemy 2.x style.#22801
laipz8200 merged 15 commits intolanggenius:mainfrom
asukaminato0721:orm-select

Conversation

@asukaminato0721
Copy link
Copy Markdown
Contributor

@asukaminato0721 asukaminato0721 commented Jul 22, 2025

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

part of #22668

Screenshots

Before After
image image

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@laipz8200 laipz8200 self-requested a review July 23, 2025 05:00
@asukaminato0721 asukaminato0721 changed the title Orm select orm filter -> where Jul 23, 2025
@asukaminato0721
Copy link
Copy Markdown
Contributor Author

.where has much more typing support than .filter.

so basically do a search and replacement.

@asukaminato0721 asukaminato0721 marked this pull request as ready for review July 23, 2025 10:43
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 💪 enhancement New feature or request labels Jul 23, 2025
laipz8200 and others added 2 commits July 24, 2025 00:16
- Fix double dot issue in _build_from_tool_file extension handling
- Update test mocks to use .where() instead of .filter() to match refactored ORM queries
- Update test mocks to use db.session.scalar instead of db.session.query for single result queries
- Fix mock_tool_file fixture to properly patch db.session.scalar

All 367 tests in factories and services modules now pass.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link
Copy Markdown
Member

@laipz8200 laipz8200 left a comment

Choose a reason for hiding this comment

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

This is a big step towards SQLAlchemy 2.x!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 23, 2025
@laipz8200 laipz8200 merged commit ef51678 into langgenius:main Jul 23, 2025
8 checks passed
@laipz8200 laipz8200 changed the title orm filter -> where Change "filter" to "where" to match SQLAlchemy 2.x style. Jul 23, 2025
@laipz8200 laipz8200 changed the title Change "filter" to "where" to match SQLAlchemy 2.x style. refactor: Change "filter" to "where" to match SQLAlchemy 2.x style. Jul 23, 2025
@asukaminato0721 asukaminato0721 deleted the orm-select branch July 24, 2025 01:43
tutkun pushed a commit to tutkun/dify that referenced this pull request Aug 15, 2025
Signed-off-by: -LAN- <[email protected]>
Co-authored-by: -LAN- <[email protected]>
Co-authored-by: Claude <[email protected]>
tutkun pushed a commit to tutkun/dify that referenced this pull request Aug 16, 2025
Signed-off-by: -LAN- <[email protected]>
Co-authored-by: -LAN- <[email protected]>
Co-authored-by: Claude <[email protected]>
@asukaminato0721 asukaminato0721 mentioned this pull request Aug 19, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💪 enhancement New feature or request lgtm This PR has been approved by a maintainer 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