"""Read repositories for project network assets.""" from typing import Any from psycopg import AsyncConnection class NetworkAssetRepository: @staticmethod async def get_pipes_by_ids( conn: AsyncConnection, pipe_ids: list[str], ) -> list[dict[str, Any]]: if not pipe_ids: return [] async with conn.cursor() as cur: await cur.execute( """ SELECT id, diameter, start_node_id AS node1, end_node_id AS node2 FROM gis.pipes WHERE id = ANY(%s) ORDER BY id """, (pipe_ids,), ) return await cur.fetchall()