phase 17: quote reserved word 'window' in all SQL queries across recommendation worker and query API

This commit is contained in:
Celes Renata
2026-04-12 03:45:51 -07:00
parent 181ed2b6cd
commit d16e15c885
3 changed files with 10 additions and 10 deletions
+5 -5
View File
@@ -351,13 +351,13 @@ async def list_trends(
params.append(ticker.upper())
idx += 1
if window:
conditions.append(f"window = ${idx}")
conditions.append(f"\"window\" = ${idx}")
params.append(window)
idx += 1
where = " AND ".join(conditions)
rows = await pool.fetch(
f"""SELECT id, entity_type, entity_id, window, trend_direction,
f"""SELECT id, entity_type, entity_id, "window", trend_direction,
trend_strength, confidence, top_supporting_evidence,
top_opposing_evidence, dominant_catalysts, material_risks,
contradiction_score, market_context, generated_at
@@ -383,7 +383,7 @@ async def list_trends(
async def get_trend(trend_id: str):
"""Get a single trend summary by ID."""
row = await pool.fetchrow(
"""SELECT id, entity_type, entity_id, window, trend_direction,
"""SELECT id, entity_type, entity_id, "window", trend_direction,
trend_strength, confidence, top_supporting_evidence,
top_opposing_evidence, dominant_catalysts, material_risks,
contradiction_score, market_context, generated_at, created_at
@@ -637,7 +637,7 @@ async def get_recommendation_evidence_drilldown(recommendation_id: str):
generated_at = rec_row["generated_at"]
if ticker and generated_at:
trend_row = await pool.fetchrow(
"""SELECT id, entity_type, entity_id, window, trend_direction,
"""SELECT id, entity_type, entity_id, "window", trend_direction,
trend_strength, confidence, top_supporting_evidence,
top_opposing_evidence, dominant_catalysts, material_risks,
contradiction_score, market_context, generated_at
@@ -691,7 +691,7 @@ async def get_trend_evidence_drilldown(trend_id: str):
Requirements: 10.4, 6.5
"""
trend_row = await pool.fetchrow(
"""SELECT id, entity_type, entity_id, window, trend_direction,
"""SELECT id, entity_type, entity_id, "window", trend_direction,
trend_strength, confidence, top_supporting_evidence,
top_opposing_evidence, dominant_catalysts, material_risks,
contradiction_score, market_context, generated_at