Upsert
Write documents to both stores in one call.
Each document carries an id, either text (which gets embedded) or a
vector, and optional metadata. dynavec splits metadata: a small filterable subset
goes to S3 Vectors, the full copy plus text goes to DynamoDB.
from dynavec import Document
db.upsert([
Document(id="1", text="apple pie recipe", metadata={"cat": "food", "rating": 5}),
Document(id="2", text="rocket launch schedule", metadata={"cat": "space"}),
], namespace="kb", auto_metadata=True)
The metadata switch
- You provide metadata — stored verbatim.
auto_metadata=True— dynavec also derivescreated_at,content_hash,word_count,char_count. Your keys win on conflict.
Re-upserting the same id overwrites it. Writes to the two stores run in parallel; see
Concurrency. To change part of a document, use
update.