Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Conversation

@whitdog47
Copy link
Contributor

@whitdog47 whitdog47 commented May 20, 2025

This PR updates the case query mechanism in the AI service to replace the deprecated from_self() function with an explicit subquery and alias approach. The changes ensure compatibility with SQLAlchemy 2.0 while maintaining the functionality of filtering related cases.

@whitdog47 whitdog47 requested review from Copilot and wssheldon May 20, 2025 02:23
@whitdog47 whitdog47 self-assigned this May 20, 2025
@whitdog47 whitdog47 added the bug Something isn't working label May 20, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the case query mechanism in the AI service to replace the deprecated from_self() function with an explicit subquery and alias approach. The changes ensure compatibility with SQLAlchemy 2.0 while maintaining the functionality of filtering related cases.

  • Replaces from_self() with a subquery and aliased model for filtering.
  • Updates import statements to include aliased from SQLAlchemy.
Comments suppressed due to low confidence (1)

src/dispatch/ai/service.py:155

  • Verify that the new subquery aliasing and filtering logic exactly replicates the intended behavior of the original query, as differences in query execution might have unexpected consequences.
related_cases.extend(db_session.query(case_alias).filter(case_alias.id != case.id).all())

@whitdog47 whitdog47 merged commit 58da618 into main May 20, 2025
11 checks passed
@whitdog47 whitdog47 deleted the bug/remove-from-self branch May 20, 2025 02:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants