fix(topology): adapt queries for psycopg 3 array syntax
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -131,11 +131,11 @@ def fetch_snapshot(snapshot_at):
|
||||
return result
|
||||
|
||||
# --- ports ---
|
||||
component_ids = tuple(component_map.keys())
|
||||
component_ids = list(component_map.keys())
|
||||
cur.execute("""
|
||||
SELECT id, component_id, port_key, display_name, direction, interface_type
|
||||
FROM ports
|
||||
WHERE component_id IN %(ids)s
|
||||
WHERE component_id = ANY(%(ids)s)
|
||||
ORDER BY component_id, port_key
|
||||
""", {"ids": component_ids})
|
||||
port_map = {}
|
||||
@@ -158,7 +158,7 @@ def fetch_snapshot(snapshot_at):
|
||||
cur.execute("""
|
||||
SELECT component_id, state_kind, state_value, details
|
||||
FROM component_states
|
||||
WHERE component_id IN %(ids)s
|
||||
WHERE component_id = ANY(%(ids)s)
|
||||
AND valid_from <= %(at)s::timestamptz
|
||||
AND (valid_to IS NULL OR %(at)s::timestamptz < valid_to)
|
||||
ORDER BY component_id, state_kind
|
||||
@@ -185,8 +185,8 @@ def fetch_snapshot(snapshot_at):
|
||||
WHERE tc.base_id = (SELECT id FROM bases WHERE code = 'guanghan')
|
||||
AND tc.valid_from <= %(at)s::timestamptz
|
||||
AND (tc.valid_to IS NULL OR %(at)s::timestamptz < tc.valid_to)
|
||||
AND pa.component_id IN %(ids)s
|
||||
AND pb.component_id IN %(ids)s
|
||||
AND pa.component_id = ANY(%(ids)s)
|
||||
AND pb.component_id = ANY(%(ids)s)
|
||||
ORDER BY tc.connection_type, pa.port_key
|
||||
""", {"ids": component_ids, "at": snapshot_at})
|
||||
for row in cur.fetchall():
|
||||
|
||||
Reference in New Issue
Block a user