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:
@@ -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))
|
||||
|
||||
@@ -58,7 +58,7 @@ async def create_note(
|
||||
due_date: date | None = None,
|
||||
recurrence_rule: dict | None = None,
|
||||
note_type: str = "note",
|
||||
metadata: dict | None = None,
|
||||
entity_meta: dict | None = None,
|
||||
) -> Note:
|
||||
# Auto-populate project_id from milestone when not explicitly provided
|
||||
if milestone_id is not None and project_id is None:
|
||||
@@ -85,7 +85,7 @@ async def create_note(
|
||||
due_date=due_date,
|
||||
recurrence_rule=recurrence_rule,
|
||||
note_type=note_type,
|
||||
metadata=metadata,
|
||||
entity_meta=entity_meta,
|
||||
)
|
||||
session.add(note)
|
||||
await session.commit()
|
||||
|
||||
@@ -2043,7 +2043,7 @@ async def execute_tool(
|
||||
body="\n".join(body_lines),
|
||||
tags=["person"],
|
||||
note_type="person",
|
||||
metadata=meta,
|
||||
entity_meta=meta,
|
||||
)
|
||||
_schedule_embedding(note.id, user_id, name, note.body)
|
||||
return {"success": True, "type": "person", "data": {"id": note.id, "name": name}}
|
||||
@@ -2075,7 +2075,7 @@ async def execute_tool(
|
||||
body="\n".join(body_lines),
|
||||
tags=["place"],
|
||||
note_type="place",
|
||||
metadata=meta,
|
||||
entity_meta=meta,
|
||||
)
|
||||
_schedule_embedding(note.id, user_id, name, note.body)
|
||||
return {"success": True, "type": "place", "data": {"id": note.id, "name": name}}
|
||||
@@ -2101,7 +2101,7 @@ async def execute_tool(
|
||||
body=body,
|
||||
tags=tags,
|
||||
note_type="list",
|
||||
metadata=meta,
|
||||
entity_meta=meta,
|
||||
)
|
||||
_schedule_embedding(note.id, user_id, name, body)
|
||||
return {"success": True, "type": "list", "data": {"id": note.id, "name": name, "item_count": len(items)}}
|
||||
|
||||
Reference in New Issue
Block a user