Skip to content

Conversation

@bjthres1
Copy link
Collaborator

No description provided.

- Deleted the `__init__.py` file from
  `stat_log_db/src/stat_log_db`.
- Refactored `db.py` to use the SQLAlchemy engine
- Removed deprecated Database sub-classes
  MemDB and FileDB
- Removed deprecated Connection classes
- Created `modules` directory for organizing
  different groups of SQLAlchemy models
- Created a new `BaseModel` class in
  `modules/base/models/base.py` for ORM mapping.
- Added `Log`, `LogLevel`, and `LogType` models
  in `modules/log/models/` with appropriate
  relationships.
- Introduced `Tag` model in
  `modules/tag/models/tag.py`.
- Implemented tests for database operations in
  `test_db.py` and removed `test_sql_injection.py`.
- Updated `tools.sh` to improve cleanup script
  functionality.
@bjthres1 bjthres1 self-assigned this Sep 10, 2025
@bjthres1 bjthres1 linked an issue Sep 10, 2025 that may be closed by this pull request
@bjthres1 bjthres1 removed their assignment Sep 10, 2025
@bjthres1 bjthres1 linked an issue Sep 10, 2025 that may be closed by this pull request
@bjthres1 bjthres1 marked this pull request as ready for review September 10, 2025 04:00
@bjthres1 bjthres1 requested a review from Copilot September 10, 2025 04:00
@bjthres1 bjthres1 linked an issue Sep 10, 2025 that may be closed by this pull request
Copy link

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 replaces the existing database connection logic with SQLAlchemy ORM and implements basic models for a logging system. The changes modernize the codebase by moving from raw SQLite3 connections to SQLAlchemy's engine-based approach with declarative models.

Key changes:

  • Replaced custom SQLite3 connection management with SQLAlchemy engine and session handling
  • Implemented SQLAlchemy models for Tag, Log, LogLevel, and LogType with a BaseModel foundation
  • Updated CLI to demonstrate the new ORM functionality with session-based database operations

Reviewed Changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tools.sh Improved cleanup logic by consolidating pycache directory removal
stat_log_db/tests/test_db.py Added comprehensive tests for the new SQLAlchemy-based database functionality
stat_log_db/src/stat_log_db/modules//models/.py Implemented SQLAlchemy models for Tag, Log, LogLevel, and LogType
stat_log_db/src/stat_log_db/modules/*/init.py Added module exports for the new models
stat_log_db/src/stat_log_db/modules/base/models/base.py Created BaseModel with common fields (id, timestamps)
stat_log_db/src/stat_log_db/db.py Completely refactored to use SQLAlchemy engine instead of raw SQLite3
stat_log_db/src/stat_log_db/cli.py Updated to demonstrate new ORM functionality
stat_log_db/pyproject.toml Added SQLAlchemy dependency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Updated the Log model to properly define type_id
and level_id as integers and added relationships
for type and level.
@bjthres1 bjthres1 added the enhancement New feature or request label Sep 10, 2025
@bjthres1 bjthres1 merged commit f3fbf59 into main Sep 10, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Database Interface Architecture Database Connection Pool/Registry SQL Injection Protection

2 participants