MCPcopy Create free account
hub / github.com/cosdata/cosdata / upsert_in_transaction

Function upsert_in_transaction

tests/rps-test.py:131–143  ·  view source on GitHub ↗
(collection_name, transaction_id, vectors)

Source from the content-addressed store, hash-verified

129
130
131def upsert_in_transaction(collection_name, transaction_id, vectors):
132 url = (
133 f"{base_url}/collections/{collection_name}/transactions/{transaction_id}/upsert"
134 )
135 vectors = [
136 {"id": vector["id"], "dense_values": vector["values"]} for vector in vectors
137 ]
138 data = {"vectors": vectors}
139 response = requests.post(
140 url, headers=generate_headers(), data=json.dumps(data), verify=False
141 )
142 if response.status_code not in [200, 204]:
143 raise Exception(f"Failed to create vector: {response.status_code}")
144
145
146def commit_transaction(collection_name, transaction_id):

Callers 1

upsert_with_retryFunction · 0.90

Calls 1

generate_headersFunction · 0.70

Tested by

no test coverage detected