| 301 | return json.dumps({"key": key, "genus": genus, "epithet": epithet}).encode() |
| 302 | |
| 303 | class TestSubject(pw.io.python.ConnectorSubject): |
| 304 | def run(self): |
| 305 | # Initial insertions. |
| 306 | self._add(api.ref_scalar(1), payload(1, "upupa", "epops")) |
| 307 | self._add(api.ref_scalar(2), payload(2, "bubo", "scandiacus")) |
| 308 | self._add(api.ref_scalar(3), payload(3, "corvus", "corax")) |
| 309 | # Update row 1: retract the old version and insert a new one. |
| 310 | # Snapshot mode should UPSERT on primary_key=key. |
| 311 | self._remove(api.ref_scalar(1), payload(1, "upupa", "epops")) |
| 312 | self._add(api.ref_scalar(1), payload(1, "upupa", "marginata")) |
| 313 | # Delete row 3 outright. |
| 314 | self._remove(api.ref_scalar(3), payload(3, "corvus", "corax")) |
| 315 | |
| 316 | class InputSchema(pw.Schema): |
| 317 | key: int |
no outgoing calls