MCPcopy Create free account
hub / github.com/TaskingAI/TaskingAI / delete_record

Function delete_record

backend/app/database_ops/retrieval/record/delete.py:6–26  ·  view source on GitHub ↗
(record: Record)

Source from the content-addressed store, hash-verified

4
5
6async def delete_record(record: Record):
7 async with postgres_pool.get_db_connection() as conn:
8 async with conn.transaction():
9 # 1. delete record chunks
10 old_num_chunks = await delete_record_chunks(conn, record.collection_id, record.record_id)
11
12 # 2. delete from db
13 await conn.execute(
14 "DELETE FROM record WHERE collection_id=$1 AND record_id=$2;",
15 record.collection_id,
16 record.record_id,
17 )
18
19 # 3. update vectordb_collection num_records and num_chunks
20 await conn.execute(
21 "UPDATE collection "
22 "SET num_records = num_records - 1, num_chunks = num_chunks - $1 "
23 "WHERE collection_id=$2;",
24 old_num_chunks,
25 record.collection_id,
26 )

Callers

nothing calls this directly

Calls 3

delete_record_chunksFunction · 0.85
get_db_connectionMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected