MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / upsert

Method upsert

app/e2e/sdk-api/src/supabase.py:73–93  ·  view source on GitHub ↗
(self, table: str, pkey_name: str, data)

Source from the content-addressed store, hash-verified

71 return response
72
73 async def upsert(self, table: str, pkey_name: str, data):
74 logging.info(f"Upserting to {table} table: {data}")
75 table_url = (
76 f"{self.supabase_url}/rest/v1/{table}?{pkey_name}=eq.{data.get(pkey_name)}"
77 )
78 headers = {
79 "apiKey": self.supabase_key,
80 "Authorization": f"Bearer {self.supabase_key}",
81 "Prefer": "resolution=merge",
82 }
83
84 async with httpx.AsyncClient() as async_client:
85 response = await async_client.put(table_url, json=data, headers=headers)
86
87 if not response.is_success:
88 json = response.json()
89 raise RuntimeError(
90 f"Error upserting to {table=}. Postgres: {json['code']=}. {json['message']=}"
91 )
92
93 return response
94
95 async def post_to_bucket(
96 self, bucket: str, session_id: str, image_bytes, filename: str

Callers 10

update_statsFunction · 0.80
v2_create_agentFunction · 0.80
v2_create_threadFunction · 0.80
create_sessionFunction · 0.80
agentsFunction · 0.80
threadsFunction · 0.80
eventsFunction · 0.80
developer_errorsFunction · 0.80
tracesFunction · 0.80

Calls 3

putMethod · 0.80
jsonMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected