-
Notifications
You must be signed in to change notification settings - Fork 57
chore(deps): upgrade SQLAlchemy from 1.4.41 to 2.0.45 #998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
database.py
Outdated
| return DeclEnumType(self.enum) | ||
|
|
||
| def process_bind_param(self, value: EnumSymbol, dialect: SQLiteDialect_pysqlite) -> str: | ||
| def process_bind_param(self, value: Optional[Any], dialect: Dialect) -> Optional[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change this from EnumSymbol to an Optional[Any]?
database.py
Outdated
| return value.value | ||
|
|
||
| def process_result_value(self, value: str, dialect: SQLiteDialect_pysqlite) -> EnumSymbol: | ||
| def process_result_value(self, value: Optional[Any], dialect: Dialect) -> Optional[EnumSymbol]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, why replace a str (which value should clearly be) with Any, that even can be null
b67f6a9 to
a99d38a
Compare
|
Fixed the type annotations - restored |
This PR upgrades SQLAlchemy to version 2.0.45, addressing breaking changes: - Update DeclarativeBase: Replace deprecated declarative_base() with new class-based DeclarativeBase pattern - Fix raw SQL execution: Wrap string SQL with text() in mod_health and tests - Update DeclEnumType: Use String(50) as impl instead of Enum to avoid SQLAlchemy 2.0's stricter enum value validation in TypeDecorator - Fix engine creation: Remove deprecated convert_unicode parameter and use StaticPool for SQLite in-memory databases to ensure connection sharing - Update type hints: Use generic Dialect type instead of SQLite-specific All 402 tests pass with the upgraded SQLAlchemy version. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Keep EnumSymbol and str types instead of Any for better type safety. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
d382165 to
c901650
Compare
|



Summary
This PR upgrades SQLAlchemy to version 2.0.45, addressing the breaking changes from the major version update. This is an equivalent replacement for PR #959 (Dependabot's auto-generated PR) but with the necessary code changes to make all tests pass.
Changes made:
declarative_base()with new class-basedDeclarativeBasepatterntext()inmod_health/controllers.pyandtests/base.pyString(50)as impl instead ofEnumto avoid SQLAlchemy 2.0's stricter enum value validation in TypeDecoratorconvert_unicodeparameter and useStaticPoolfor SQLite in-memory databases to ensure proper connection sharing during testsDialecttype instead of SQLite-specific dialect typesTest plan
🤖 Generated with Claude Code