Skip to main content

ashurbanipal-flask

A read-only database browser you mount inside your own Flask app. It connects with your app's database settings, so there are no extra credentials and nothing extra to deploy. Part of Ashurbanipal.

Requires Python 3.12+ and Flask 3.

Install

Pick the extra for your database:

uv add 'ashurbanipal-flask[postgres]'   # or: pip install 'ashurbanipal-flask[postgres]'
uv add 'ashurbanipal-flask[mysql]'      # MySQL or MariaDB
uv add ashurbanipal-flask               # SQLite needs no extra

Quick start

import os

from flask import Flask

from ashurbanipal import Config, router
from ashurbanipal.db.postgres import PgSource

app = Flask(__name__)
# your own routes

config = Config(enabled=True)
source = PgSource(dsn=os.environ["DATABASE_URL"])
app.register_blueprint(router(config, [("primary", source)]))

Run flask run and open http://localhost:5000/__ashurbanipal.

Turn it on only where you want it

enabled defaults to False. When it is off, every viewer path returns 404. Decide where to enable it, for example from an environment variable:

config = Config(enabled=os.environ.get("ASHURBANIPAL_ENABLED") == "true")

Protect it

Ashurbanipal has no login. Anyone who can reach /__ashurbanipal can read every table your app's database user can read. Put your own auth in front, and check a role, not just a login. router() returns a blueprint, so a hook on it covers only the viewer:

from flask import abort

bp = router(config, [("primary", source)])


@bp.before_request
def require_admin():
    if not is_admin():
        abort(401)


app.register_blueprint(bp)

A hook on the blueprint follows it to any mount path you choose.

MySQL, MariaDB, or SQLite

from ashurbanipal.db.mysql import MySqlSource, connect_kwargs_from_url

source = MySqlSource(**connect_kwargs_from_url(os.environ["MYSQL_URL"]))  # mysql://user:pass@host:3306/db

MySqlSource also takes pymysql.connect() keyword arguments directly, for example MySqlSource(host="localhost", user="app", password="...", database="app").

from ashurbanipal.db.sqlite import SqliteSource

source = SqliteSource(path="app.db")

SQLite needs a real file. :memory: does not work, because each request opens a new connection and sees an empty database.

Column comments and common-value stats are empty on MySQL and SQLite.

More than one database

Pass more than one source. The first one is the default, and the UI lets you switch between them:

router(
    config,
    [
        ("orders", PgSource(dsn=os.environ["ORDERS_DATABASE_URL"])),
        ("billing", PgSource(dsn=os.environ["BILLING_DATABASE_URL"])),
    ],
)

Connections

Each request opens its own database connection and closes it at the end. There is no pool. For pooling, write your own DbSource around your pool.

Configuration

from ashurbanipal import Config, Limits

config = Config(
    enabled=True,
    limits=Limits(default_page_size=50, max_page_size=100, query_timeout_secs=5),  # optional; the defaults
)

app.register_blueprint(router(config, sources, mount="/__ashurbanipal"))  # mount is optional; change the URL path

The configuration table lists every option, including instance and siblings. Those let the UI show which of your other services are reachable. Import Instance and Sibling from ashurbanipal.

See also

Metadata

Release files for ashurbanipal-flask 0.13.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 ashurbanipal-flask 0.13.0
File Size Uploaded Provenance Actions
ashurbanipal_flask-0.13.0.tar.gz 81.2 kB With provenance Details for ashurbanipal_flask-0.13.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ashurbanipal-flask 0.13.0
File Interpreter ABI Platform Actions
ashurbanipal_flask-0.13.0-py3-none-any.whl Python 3 none any Details for ashurbanipal_flask-0.13.0-py3-none-any.whl

Total release size: 125.6 kB

Release files / ashurbanipal_flask-0.13.0.tar.gz

Download URL ashurbanipal_flask-0.13.0.tar.gz
Size 81.2 kB
Tags Source
SHA-256 checksum
How to use checksums
26f53e09fa000397759fe4e22367643bc6477a0aaa975e69f6c3e0b4921a169a
BLAKE2b-256 checksum
How to use checksums
b0687649412fefc3001c0e30c2d8db61243891587fe6702eda7694fc54d3c30d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / ashurbanipal_flask-0.13.0-py3-none-any.whl

Download URL ashurbanipal_flask-0.13.0-py3-none-any.whl
Size 44.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f54df2cedc3973360c49a3ae2d33767fcfe90cc365aa0814c21875bea2d6c0ff
BLAKE2b-256 checksum
How to use checksums
0b4faed054af6329fe9aba5fa1a769e8b1ea586464f63c7e96e712f375117e32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for ashurbanipal-flask 0.13.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ashurbanipal_flask-0.13.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

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