Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions python_template_server/db/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
"""Database manager classes for servers using this template."""

from .base_database_manager import BaseDatabaseManager

__all__ = [
"BaseDatabaseManager",
]
7 changes: 5 additions & 2 deletions python_template_server/db/base_database_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@


class BaseDatabaseManager(ABC):
"""Manager class for database operations."""
"""Manager class for database operations.

Subclasses must implement the `db_url` property to provide the correct database URL.
"""

def __init__(self, db_config: DatabaseConfig) -> None:
"""Initialize the database manager."""
Expand All @@ -25,4 +28,4 @@ def __init__(self, db_config: DatabaseConfig) -> None:
@property
@abstractmethod
def db_url(self) -> str:
"""Get the database URL."""
"""Get the database URL using the `DatabaseConfig.db_url()` method."""
2 changes: 1 addition & 1 deletion tests/db/test_base_database_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
from sqlalchemy import Engine

from python_template_server.db.base_database_manager import BaseDatabaseManager
from python_template_server.db import BaseDatabaseManager
from python_template_server.models import DatabaseConfig

MOCK_DB_FILENAME = "test.db"
Expand Down