Since dataset accepts a dict, we can pass this directly to insert.
Again, dataset will detect and add any new columns automatically.

That's it.

NOTE: In a production app you would want to add validation. You may have
noticed that we never defined nor identified any fields for our todo items. This is
because we are trusting the client to validate any input posted to our server. This
is, of course, a bad idea in any production app.

Now that we can add new items, let's modify the index to load them from the table.

We simply used dataset find_one to find the item with given id and aborting with
a 404 if not found.

Conclusion

In this article, we used dataset to add database persistence to our todo app.
Our todo list will now survive a server restart. We did neglect to add validation
or any access control. We may revisit these oversights in future articles.
In the next article we will setup unit testing.

The code is available on GitHub with tag dataset or compared to previous article.