Before you start

Two inputs with the same key converge on one operation.
Eric Muriel · © Eric Muriel
Advanced · Go deeper45 min4 steps

Prevent duplicate tasks with Python and SQLite

Build and test a local event ledger with a unique key and a transaction. Repeat the execution and verify that only two tasks are stored.

What you will build

  • A local demonstration of idempotency: processing the same event again does not create another task.

What you need

Complete the CSV tutorial and know how to run a Python script.

Python 3 with sqlite3 available. A new exercise folder without real databases.

  1. 1. Prepare an isolated workspace
  2. 2. Follow the transaction in the code
  3. 3. Process the sample batch
  4. 4. Repeat and test a conflict