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

Function upsert_in_transaction

tests/load-test.py:139–152  ·  view source on GitHub ↗
(collection_name, transaction_id, vectors)

Source from the content-addressed store, hash-verified

137
138
139def upsert_in_transaction(collection_name, transaction_id, vectors):
140 url = (
141 f"{base_url}/collections/{collection_name}/transactions/{transaction_id}/upsert"
142 )
143 vectors = [
144 {"id": str(vector["id"]), "dense_values": vector["values"]}
145 for vector in vectors
146 ]
147 data = {"vectors": vectors}
148 response = requests.post(
149 url, headers=generate_headers(), data=json.dumps(data), verify=False
150 )
151 if response.status_code not in [200, 204]:
152 raise Exception(f"Failed to create vector: {response.status_code}")
153
154
155def commit_transaction(collection_name, transaction_id):

Callers 1

Calls 1

generate_headersFunction · 0.70

Tested by

no test coverage detected