Skip to main content

Read, update, and delete a task

Continue with the task you created in Create your first task. Read it by its generated identifier, mark it complete, and remove it when the work is finished.

What you will do#

By the end of this guide, you will have:

  • read the stored Build with TaruviBase task;
  • changed its done value from false to true;
  • verified the updated value; and
  • deleted the task and confirmed that its identifier no longer resolves.

Before you begin#

Complete Create your first task, or prepare the same starting state:

  • a non-production app with a tasks table;
  • a record whose title is Build with TaruviBase and whose done value is false;
  • the generated record identifier, referred to below as TASK_ID; and
  • a connected JavaScript, Python, Refine, REST, or TaruviBase Console interface with permission to read and change that record.

If you no longer have the returned identifier, open Datatables, select tasks, and copy the id from the Build with TaruviBase row. Treat the value as opaque; do not calculate or reconstruct it.

For Python, open a new client with with create_taruvi_client() as client: and keep that context open while you run the Python operations below.

For Refine, register the provider and sign in, then import useOne, useUpdate, and useDelete from @refinedev/core. Place hooks at the top level of a component beneath <Refine>. Invoke mutations from event handlers after reviewing the target task.

1. Read your first task#

Replace TASK_ID with the task's id from Create your first task.

await database.from('tasks').get('TASK_ID').execute();

The record has the identifier you supplied and these stored values:

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Build with TaruviBase",
"done": false
}

Your id may differ.

2. Mark the task complete#

Use the same TASK_ID and send only the field that changes.

await database.from('tasks').get('TASK_ID').update({done: true}).execute();

3. Verify the update#

After the update succeeds, repeat the read from step 1 with the same TASK_ID, or refresh the row in TaruviBase Console. The stored record now has done set to true:

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Build with TaruviBase",
"done": true
}

4. Delete the completed task#

Use the same TASK_ID to remove the record.

await database.from('tasks').delete('TASK_ID').execute();

5. Confirm the task is gone#

Repeat the read from step 1 with TASK_ID. JavaScript and Python throw NotFoundError, while REST returns HTTP 404. In Refine, refresh the useOne query and inspect query.error for the missing-record response. In TaruviBase Console, refresh Data and confirm that no row with TASK_ID remains.

You completed the task-list data flow#

Your application used the same site, app, table, record identifier, and authorization context throughout the flow:

Next steps#