fix(zopk): Naprawa błędu JSONB cast w SQLAlchemy
Problem: `:entity_json::jsonb` było interpretowane przez SQLAlchemy jako parametr `:entity_json` z dodatkowym `:jsonb` (błąd składni SQL) Rozwiązanie: Użycie CAST(:entity_json AS jsonb) zamiast ::jsonb Naprawione miejsca: - get_entity_merge_preview() - linia 1919 - merge_entities() - linia 1831 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8bdbd04c8c
commit
4dcfc1b8e8
@ -1828,7 +1828,7 @@ def merge_entities(
|
||||
)
|
||||
FROM jsonb_array_elements(entities_involved::jsonb) AS elem
|
||||
)
|
||||
WHERE entities_involved::jsonb @> :entity_json::jsonb
|
||||
WHERE entities_involved::jsonb @> CAST(:entity_json AS jsonb)
|
||||
"""), {
|
||||
'primary_id': primary_id,
|
||||
'duplicate_id': duplicate_id,
|
||||
@ -1916,7 +1916,7 @@ def get_entity_merge_preview(
|
||||
# Count facts where duplicate entity is in entities_involved array
|
||||
facts_with_entity = db_session.execute(text("""
|
||||
SELECT COUNT(*) FROM zopk_knowledge_facts
|
||||
WHERE entities_involved::jsonb @> :entity_json::jsonb
|
||||
WHERE entities_involved::jsonb @> CAST(:entity_json AS jsonb)
|
||||
"""), {'entity_json': f'[{{"id": {duplicate_id}}}]'}).scalar() or 0
|
||||
|
||||
relations_source = db_session.query(func.count(ZOPKKnowledgeRelation.id)).filter(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user