-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make database saver classes inheritance-friendly (#2615)
Replace hardcoded database saver class names with `cls` in `from_conn_string` factory methods to improve subclassing support ## Changes * Replaced direct class instantiations with `cls(conn)` in `from_conn_string` classmethods across all database implementations * Updated both synchronous and asynchronous variants for DuckDB, PostgreSQL, and SQLite savers ## Why This refactor makes the database saver classes more extensible by following Python's convention of using `cls` in class methods. This enables proper inheritance patterns where subclasses can reuse the factory methods without needing to override them. Previously, the hardcoded class names would always instantiate the parent class, even when called from a subclass. ## Testing The change is backward compatible and doesn't alter existing functionality. All existing tests should continue to pass as this is purely a structural refactoring that preserves the current behavior while improving extensibility. ## Notes This PR addresses follow up on comments from #2518 - AsyncPostgresSaver didn't need to be fixed but many of the other DB saver classes did.
- Loading branch information
1 parent
5fa196a
commit aca6710
Showing
6 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters