MCPcopy Create free account
hub / github.com/ExtendDB/extenddb / delete_data

Function delete_data

samples/sample_app.py:465–491  ·  view source on GitHub ↗

Demonstrate DeleteItem.

(client)

Source from the content-addressed store, hash-verified

463# ---------------------------------------------------------------------------
464
465def delete_data(client) -> None:
466 """Demonstrate DeleteItem."""
467 section("Step 8: Delete Data (DeleteItem)")
468
469 # Delete the transaction-created user and order
470 client.delete_item(
471 TableName=USERS_TABLE,
472 Key={"userId": {"S": "user-004"}},
473 )
474 print(" ✓ Deleted user-004")
475
476 client.delete_item(
477 TableName=ORDERS_TABLE,
478 Key={
479 "customerId": {"S": "user-004"},
480 "orderId": {"S": "ord-401"},
481 },
482 )
483 print(" ✓ Deleted order ord-401")
484
485 # Verify deletion
486 resp = client.get_item(
487 TableName=USERS_TABLE,
488 Key={"userId": {"S": "user-004"}},
489 )
490 assert "Item" not in resp, "user-004 should be deleted"
491 print(" ✓ Verified user-004 no longer exists")
492# ---------------------------------------------------------------------------
493# Step 9: Drop tables
494# ---------------------------------------------------------------------------

Callers 1

mainFunction · 0.85

Calls 3

sectionFunction · 0.85
delete_itemMethod · 0.80
get_itemMethod · 0.80

Tested by

no test coverage detected