Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Instant serverless APIs, powered by SQLite

Instant serverless APIs, powered by SQLite

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.

Presented at PyCon US 2019

Simon Willison

May 04, 2019
Tweet

More Decks by Simon Willison

Other Decks in Programming

Transcript

  1. Some handy features • Filtering and faceting • Custom SQL

    queries • JSON API to everything • Export table (or query results) as CSV
  2. The secret sauce is SQLite • Small, fast, ubiquitous •

    A database is a single file • Doesn’t scale well for writes… • … but who cares if your data is read-only? • Ship your data and code in the same container!
  3. datasette publish cloudrun \ /tmp/pypi.db \ --title="PyPI Top 1500 Packages"

    \ --name=pypi \ --install=datasette-vega \ --branch=master \ --extra-options="--cors" Thanks, Romain Primet!