fix: rename Note.metadata → entity_meta (reserved by SQLAlchemy Declarative API)

SQLAlchemy reserves 'metadata' as a class attribute on declarative models.
Renamed to 'entity_meta' with explicit column name 'metadata' so the DB
column is unchanged but the Python attribute no longer conflicts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-31 18:13:47 -04:00
parent 80f30b705d
commit 95056d5be7
4 changed files with 11 additions and 10 deletions
+3 -3
View File
@@ -12,7 +12,7 @@ _SNIPPET_LEN = 200
def _note_to_item(note: Note) -> dict:
meta = note.metadata or {}
meta = note.entity_meta or {}
item: dict = {
"id": note.id,
"note_type": note.entity_type,
@@ -184,14 +184,14 @@ async def get_people_and_places_context(user_id: int) -> str:
if people:
parts = []
for p in people:
meta = p.metadata or {}
meta = p.entity_meta or {}
rel = meta.get("relationship", "")
parts.append(f"{p.title}" + (f" ({rel})" if rel else ""))
lines.append("Known people: " + ", ".join(parts))
if places:
parts = []
for p in places:
meta = p.metadata or {}
meta = p.entity_meta or {}
addr = meta.get("address", "")
parts.append(f"{p.title}" + (f" {addr}" if addr else ""))
lines.append("Known places: " + "; ".join(parts))