Production POST /weight-profiles → 500 SyntaxError.
## Root cause
SQLAlchemy text() parser трактует ':weights' followed by '::jsonb' двусмысленно:
- ':weights' — named param binding (должен стать %(weights)s)
- '::jsonb' — PG cast operator
Parser НЕ распознаёт :weights как параметр когда сразу следует :: cast.
Result: psycopg видит literal ':weights' в SQL → syntax error.
```
LINE 5: ($1, $2, :weights::jsonb, $3, $4)
^
parameters: {user_id, profile_name, is_default, description}
↑ note: 'weights' missing — SQLAlchemy skipped it
```
## Fix
Replace ambiguous :weights::jsonb с CAST(:weights AS jsonb):
- _INSERT (line 102)
- _UPDATE dynamic 'weights = :weights::jsonb' (line 273)
CAST() syntax не имеет ambiguity, SQLAlchemy корректно bind'ит :weights.
## Affected endpoints
- POST /api/v1/admin/site-finder/weight-profiles (create)
- PUT /api/v1/admin/site-finder/weight-profiles/{id} (update with weights)
Refs: user report 2026-05-15
Co-authored-by: lekss361 <claudestars@proton.me>
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| cadastre_fetch.py | ||
| filters.py | ||
| gate_verdict.py | ||
| noise_loader.py | ||
| parser.py | ||
| poi_loader.py | ||
| pzz_loader.py | ||
| quarter_dump_lookup.py | ||
| scorer.py | ||
| velocity.py | ||
| weight_profiles.py | ||