Try an interactive version of this dialog: Sign up at solve.it.com, click Upload, and pass this URL.

1. sqlite-web Demo

Here's a demo of using sqlite-web to visually inspect, edit, and run queries on your SQLite databases directly inside SolveIt! 🙂

2. Create New Port Mapping

Create a new port mapping via your SolveIt instance dashboard. e.g. on port 8002. image.png

3. Install sqlite-web

Install sqlite-web if you haven’t already done so.

!pip install sqlite-web
Collecting sqlite-web
  Downloading sqlite_web-0.7.2-py3-none-any.whl.metadata (7.1 kB)
Requirement already satisfied: flask in /app/data/.local/lib/python3.12/site-packages (from sqlite-web) (3.1.2)
Collecting peewee>=3.0.0 (from sqlite-web)
  Downloading peewee-4.0.4-py3-none-any.whl.metadata (8.6 kB)
Requirement already satisfied: pygments in /usr/local/lib/python3.12/site-packages (from sqlite-web) (2.20.0)
Requirement already satisfied: blinker>=1.9.0 in /app/data/.local/lib/python3.12/site-packages (from flask->sqlite-web) (1.9.0)
Requirement already satisfied: click>=8.1.3 in /usr/local/lib/python3.12/site-packages (from flask->sqlite-web) (8.3.2)
Requirement already satisfied: itsdangerous>=2.2.0 in /usr/local/lib/python3.12/site-packages (from flask->sqlite-web) (2.2.0)
Requirement already satisfied: jinja2>=3.1.2 in /usr/local/lib/python3.12/site-packages (from flask->sqlite-web) (3.1.6)
Requirement already satisfied: markupsafe>=2.1.1 in /usr/local/lib/python3.12/site-packages (from flask->sqlite-web) (3.0.3)
Requirement already satisfied: werkzeug>=3.1.0 in /app/data/.local/lib/python3.12/site-packages (from flask->sqlite-web) (3.1.4)
Downloading sqlite_web-0.7.2-py3-none-any.whl (781 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/781.4 kB ? eta -:--:--
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 781.4/781.4 kB 20.2 MB/s  0:00:00
Downloading peewee-4.0.4-py3-none-any.whl (144 kB)
Installing collected packages: peewee, sqlite-web

   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/2 [sqlite-web]

Successfully installed peewee-4.0.4 sqlite-web-0.7.2

4. Selecting the Database

You can open an existing database in the current directory or via a path. Here are the databases in the current folder.

!ls *.db
multi-port_demo.db  python_tool_for_fasthtml.db  template.db  z3.db  z34.db

5. Handle Port Conflicts

I use port 8002 in this demo. If there is an existing process on this port then you can kill it with the following command.

!lsof -ti :8002 | xargs kill

6. Start the sqlite-web Server

import subprocess
proc = subprocess.Popen(["sqlite_web", "-H", "0.0.0.0", "-p", "8002", "-q", "z3.db"])
 * Serving Flask app 'sqlite_web.sqlite_web'
 * Debug mode: off

7. Opening the Application

Start the sqlite-web server.

Here's a link to open the sqlite-web application. If using a different port than 8002, replace with your own port number.

from fasthtml.common import *
import json
A("Try it out", href="https://"+json.loads(os.environ['PUBLIC_DOMAINS'])['8002'], target='_blank')

When running you should see the sqlite-web application via the port mapping URL. Click the links to the left to inspect/edit tables, or create new tables and run queries via the text box located at the top right. image.png

8. Stopping the sqlite-web Server

Close the current sqlite-web process when done.

proc.terminate()