from datetime import datetime import asyncpg _INSERT_STATUS = """ INSERT INTO presence (account_id, peer_id, ts, status, last_online_date, next_offline_date, raw) VALUES ($1, $2, $3, $4, $5, $6, $7::jsonb) ON CONFLICT (account_id, peer_id, ts) DO NOTHING """ async def insert_status( # noqa: PLR0913 pool: asyncpg.Pool, account_id: int, peer_id: int, ts: datetime, status: str, last_online_date: datetime | None, next_offline_date: datetime | None, raw: str, ) -> None: await pool.execute( _INSERT_STATUS, account_id, peer_id, ts, status, last_online_date, next_offline_date, raw, )