Add base database manager#89
Merged
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a foundational database layer to the project using SQLModel, adds configuration support for database settings, and provides comprehensive unit tests for the new functionality. The most important changes are grouped below:
Database Layer Implementation:
sqlmodelas a project dependency inpyproject.tomlto enable SQLModel-based database operations.BaseDatabaseManageras an abstract base class for database management, initializing the SQLModel engine and handling database URL configuration.python_template_server/db/__init__.py.Configuration Enhancements:
DatabaseConfigmodel to encapsulate database directory and URL construction logic, and integrated it into the mainTemplateServerConfigas a newdbfield. [1] [2]Testing Infrastructure:
tests/conftest.pyfor mocking database configuration and temporary database paths, ensuring isolated and reliable tests. [1] [2] [3] [4] [5]tests/db/test_base_database_manager.pywith unit tests for the database manager, including initialization and URL property checks.tests/test_models.pywith unit tests for the newDatabaseConfigand its integration intoTemplateServerConfig. [1] [2] [3] [4]Test Suite Maintenance:
tests/test_template_server.pyfor improved type consistency. [1] [2]