Running Datasette on AWS Lambda
I love software tools that (a) are opinionated and (b) get out of the developer’s way. These seem like principles that are in tension with each other, but they don’t have to be.
Consider the problem of exposing a data layer to a web stack. We’re spoiled for choice:
By opinionated, I mean that the tool has a clear vision on how to accomplish the task at hand. This usually means the authors have spent many hours thoughtfully considering the problem and making judicious tradeoffs.
By in the way, I mean the tool’s vision doesn’t match your own. :)
In the particular case of data access libraries, I’m a huge fan of systems that view the power of SQL, window functions, common table expressions and all, as a positive, not a negative to be hidden from the user. This can allow very rapid prototyping for people comfortable with SQL.
For Postgres, there’s PostgREST. For SQLite, there’s Datasette.
Since my love of SQLite is no secret, I’ve recently been spending a lot of time with Datasette. In particular, I hacked up the CloudFormation glue to make it possible to run Datasette fully serverlessly, using Amazon API Gateway, AWS Lambda, S3 and the excellent mangum adapter for ASGI.
You can see the results in the datasette-lambda repository for now. At some point, I’ll package it into a publish plugin for Datasette itself.