Skip to main content

SQLab

SQL adventure builder logo

An SQLab adventure is a text-based game where the player evolves through a series of isolated or interconnected puzzles by crafting SQL queries.

It consists in a standalone database encompassing the core dataset, a handful of stored procedures, and a table of encrypted messages (such as narrative elements, puzzle statements, answers, explanations, etc.).

There is no requirement to wrap a dedicated application around this database to “run” the game. It can be played on any generic GUI such as DBeaver, phpMyAdmin, pgAdmin, or directly in a command-line interface.

Each question comes with a unique formula, for example, salt_042(sum(hash) OVER ()). Appended to the SELECT clause, this formula calculates a decryption token, which may unlock the next episode or, if the query is incorrect, a tailored hint (assuming the game's creator has provided one).

In an educational context, this setup enables the students to learn and practice SQL without constant oversight. The instructor might stave off boredom by logging their queries and injecting new hints as needed, improving the game for all involved.

Examples on GitHub

Game Pitch Versions DBMS Included
SQLab Island An adaptation of SQL Island by Johannes Schildgen English MariaDB, MySQL, PostgreSQL, SQLite Sources + SQLab database
SQLab Sessform A set of independent exercises + Mortelles Sessions, a police investigation on a training company French MySQL, PostgresQL SQLab database
SQLab Corbeau An original adaptation of the movie Le Corbeau by Henri-Georges Clouzot (1943) French MySQL Sources + SQLab database
SQLab Club An adaptation of PostgreSQL Exercises by Alisdair Owens English PostgreSQL Sources + SQLab database (coming later)

How can I create my own SQLab adventure?

The sqlab command-line tool is not required to play, but is necessary to create a new adventure. It requires Python 3.9 or later.

SQLite is supported out of the box. For any other DBMS, install the matching extra (mysql, mariadb, postgresql, duckdb), as shown below. Add graph if you want sqlab to render the activity map. Or all to get everything.

uv installs sqlab as a standalone tool, in its own isolated environment, and makes the sqlab command available everywhere:

uv tool install sqlab                      # SQLite only
uv tool install "sqlab[postgresql]"        # SQLite + PostgreSQL
uv tool install "sqlab[mysql,graph]"       # several extras at once

To add an extra to an existing installation, run the command again with --force:

uv tool install "sqlab[postgresql,duckdb]" --force

To upgrade or remove it:

uv tool upgrade sqlab
uv tool uninstall sqlab

To run it once, without installing it:

uvx --from "sqlab[postgresql]" sqlab --help

With uv, inside a project

If your adventure is a uv project (it has a pyproject.toml), add sqlab as a dependency, then run it through uv:

uv add "sqlab[postgresql]"
uv run sqlab --help

To add another extra later, run uv add again with the extra you want:

uv add "sqlab[postgresql,mysql]"

With pip

Use a virtual environment so as not to pollute your system Python:

python -m venv .venv
source .venv/bin/activate        # on Windows: .venv\Scripts\activate
pip install sqlab                # SQLite only
pip install "sqlab[postgresql]"  # SQLite + PostgreSQL
pip install "sqlab[all]"         # every supported DBMS + graph rendering

To add an extra later, run pip install again in the same environment:

pip install "sqlab[mysql]"

Documentation

The documentation is not yet available. In the meantime, you may explore the repository of SQLab Island. The provided dataset and Jupyter notebooks serve as source material for the generation of the SQLab database.

Metadata

Release files for sqlab 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlab 0.8.0
File Size Uploaded Provenance Actions
sqlab-0.8.0.tar.gz 1.1 MB Without provenance Details for sqlab-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sqlab 0.8.0
File Interpreter ABI Platform Actions
sqlab-0.8.0-py3-none-any.whl Python 3 none any Details for sqlab-0.8.0-py3-none-any.whl

Total release size: 1.2 MB

Release files / sqlab-0.8.0.tar.gz

Download URL sqlab-0.8.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
60dd99424321003f9b5ac2efec4b1016e1ad7ddb4badb1027ef8dfee6e2582a1
BLAKE2b-256 checksum
How to use checksums
b07befdf358076aaf023846bc2a972535d5804a0b1e98d69c1136e3793f7eee3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / sqlab-0.8.0-py3-none-any.whl

Download URL sqlab-0.8.0-py3-none-any.whl
Size 56.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47aa8c9ff968a53591bb72f021ee53020ec6286bafed67cc6004892df5fea57a
BLAKE2b-256 checksum
How to use checksums
241eb14dcde53d0d5cd73cb1684bc0a8f4eb38595c968df396103ed33aea035d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for sqlab 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page