PyCon 2019 in Cleveland, Ohio

Saturday 12:10 p.m.–12:55 p.m. in Room 26A/B/C

Instant serverless APIs, powered by SQLite

Simon Willison

Description

Serverless computing is all about paying only for what you use: it can scale up to handle millions of requests, but it can also scale down to 0, costing you nothing if your application is not receiving any traffic. Serverless tends to get expensive when databases are involved.... but if your data is static or changes infrequently, you can use serverless tools to provide powerful interactive APIs extremely cheaply. [Datasette](https://datasette.readthedocs.io/) is an open-source Python tool that provides an instant, read-only JSON API for any SQLite database. It also provides tools for packaging the database up as a Docker container and instantly deploying that container to a number of different serverless hosting platforms. This makes it a powerful tool for sharing interesting data online, in a way that allows users to both explore that data themselves and build their own interpretations of the data using the Datasette JSON API. In this session I'll show you how to use Datasette to publish data, and illustrate examples of the exciting things people have already built using the tool - including a number of real-world data journalism projects. I'll also teach people how to use some of the other tools in the Datasette ecosystem: * [Datasette Publish](https://publish.datasettes.com/), which allows CSV data to be published using Datasette to a serverless hosting account owned by the user, without any engineering experience required. * [csvs-to-sqlite](https://pypi.org/project/csvs-to-sqlite/), a tool for efficiently converting large numbers of CSV files into a Datasette-compatible SQLite database. * [sqlite-utils](https://sqlite-utils.readthedocs.io/), a library that lets users create complex databases from custom data feeds in just a few lines of Python code (ideal for working with Jupyter notebooks). I'll discuss the philosophy and design behind Datasette, including how immutable SQLite databases make for an impressively scalable solution for inexpensively serving complex data on the internet. Finally, I'll be exploring how Datasette takes advantage of Python 3 asyncio and the new ASGI specification.