Recipes
Short snippets for the jobs the SDK gets asked to do every day. Each recipe is one runnable code block and a paragraph of framing. Skim the table, copy the recipe you need, replace the placeholders, run it.
These are not tutorials. For a walked-through workflow, see Examples and the notebooks it links.
Index
| Recipe | Topic |
|---|---|
| Fetch and update an alert | Move an alert to a queue and record the move in a comment. |
| Bulk upsert 1000 documents | A bulk write with per-row result introspection. |
| Search across two entity types | Multi-type Search.types(...) with field projection. |
| Disposition with prompts | Handle DispositionPromptRequiredError and retry cleanly. |
| Async fanout pattern | asyncio.gather plus a semaphore throttle over the *_async siblings. |
| User and group fields | UserRef and GroupRef field updates. |
| Flaky tenant retry tuning | Retry keywords for a tenant with intermittent 503s. |
| Export and diff configuration | Export config bundles from two tenants and diff them. |
| Re-index after a configuration change | Unsearchable index, then start_full(), then make_searchable(). |
| Create and walk a relationship | Create a typed relationship and list neighbors. |
| Claim and complete a workflow task | Claim a task, then complete it with an action and document field changes. |
Paginate with iter | The generator pattern for paginated list-style results. |
| From search to bound objects | Hydrate SearchHits into bound Document / Alert instances. |
| Geo radius query | F.geo_radius composed with Q.text. |
| Preview a search request as curl or Python | Capture, share, snapshot, or log a call with *_preview().to_curl() or .to_httpx(). |
| Validate input against a reference list | Validate user input and surface bad values cleanly. |
| Mock the SDK in pytest | Stub SVIClient with object.__new__ and monkeypatch. |
Conventions
Every recipe assumes you have already built and authenticated an SVIClient:
import sasvi
client = sasvi.SVIClient.from_env()
Recipes leave out try / except unless the exception is the topic. To recover from
a typed exception, see the Errors reference
and the Troubleshooting hub.
Go further
- Examples notebooks. Long-form walkthroughs.
- API reference. Exact method signatures.
- Errors reference. The typed exception hierarchy.