Skip to content

Commit b615734

Browse files
committed
Corrected long comments
1 parent 7db2e25 commit b615734

6 files changed

Lines changed: 148 additions & 719 deletions

File tree

app/database.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
2-
================================================================================
2+
===============================================================================
33
DATABASE LAYER - PERSISTENCE AND ORM
4-
================================================================================
4+
===============================================================================
55
66
Module: app.database
77
Purpose: Database connection management, ORM models, and session handling
@@ -18,7 +18,8 @@
1818
----------------
1919
@c4-container: Database Layer
2020
@c4-technology: Python 3.12, SQLAlchemy 2.0, SQLite 3
21-
@c4-description: ORM-based persistence layer managing note storage and retrieval
21+
@c4-description: ORM-based persistence layer managing note storage and retrieva
22+
l
2223
@c4-responsibilities:
2324
- Maintain database connection and session lifecycle
2425
- Define database schema through ORM models
@@ -43,7 +44,8 @@
4344
- Rationale: Automatic SQL generation reduces errors
4445
- Rationale: Database agnostic (easy to switch to PostgreSQL later)
4546
- Trade-off: Slight performance overhead vs raw SQL
46-
- Alternative Considered: Direct SQL with aiosqlite (rejected for simplicity)
47+
- Alternative Considered: Direct SQL with aiosqlite (rejected
48+
for simplicity)
4749
4850
3. **Session Management Pattern**
4951
- Pattern: Dependency injection via get_db() generator
@@ -68,7 +70,8 @@
6870
SYSTEM INTERACTIONS
6971
-------------------
7072
@c4-uses: SQLite Database - "Reads and writes note data" - "SQL/SQLite3"
71-
@c4-used-by: API Application (app.main) - "Requests database sessions" - "SQLAlchemy ORM"
73+
@c4-used-by: API Application (app.main) - "Requests database sessions" - "SQLAl
74+
chemy ORM"
7275
7376
DATABASE SCHEMA
7477
---------------
@@ -100,7 +103,7 @@
100103
- [ ] Add database connection pooling for production
101104
- [ ] Implement read replicas for scaling read-heavy workloads
102105
103-
================================================================================
106+
===============================================================================
104107
"""
105108

106109
from sqlalchemy import create_engine, Column, Integer, String, DateTime
@@ -163,7 +166,8 @@ class NoteDB(Base):
163166
164167
DESIGN CHOICES
165168
--------------
166-
1. Separate from Pydantic models (NoteCreate, Note) for separation of concerns
169+
1. Separate from Pydantic models (NoteCreate, Note) for
170+
separation of concerns
167171
- NoteDB: Database representation (ORM)
168172
- Note: API response representation (Pydantic)
169173
- NoteCreate: API request representation (Pydantic)

0 commit comments

Comments
 (0)