Coverage for chalicelib/core/mcp/tracer.py: 57%

7 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 12:56 +0000

1import logging 

2 

3from chalicelib.utils import pg_client 

4 

5logger = logging.getLogger(__name__) 

6 

7 

8def store_client_id(client_id: str, user_id: int): 

9 with pg_client.PostgresClient() as cur: 

10 query = cur.mogrify( 

11 """ 

12 INSERT INTO public.mcp_app_users(user_id, client_id) 

13 VALUES (%(user_id)s, %(client_id)s) ON CONFLICT DO NOTHING;""", 

14 {"client_id": client_id, "user_id": user_id, }, 

15 ) 

16 cur.execute(query=query)