In this tutorial, we build a web app using a pre-existing database on a machine outside of Anvil.

Follow along to learn how to deploy any database as a web app - we’re using a standard SQL database (Postgres) but the same approach would work for other databases such as MySQL, MongoDB or Redis.

The trick is to use an Uplink script to connect to the database - this is especially helpful if the database is inside a private network, since you don’t need to open the database ports to the outside world. The Uplink script provides a layer that allows you to expose only very specific queries to your web app.

We’re going to connect an Anvil web app to an external SQL database by using an Uplink script as a proxy.

We’re going to connect an Anvil web app to an external SQL database by using an Uplink script as a proxy.

Chapters

In this tutorial, you'll:

Query an external database from Python

Write a simple Python script to query the external database and get its contents as Python objects.

Connect your Python script to Anvil

Call your Python script from the web browser using the Anvil Uplink.

Display your items in an interactive table online.

Add, Edit and Delete your items from your app

Edit your database rows from your web app, add new ones, and delete existing ones.

Click the following link to clone the finished app and explore it yourself.