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.14.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.14.0
File Size Uploaded Provenance Actions
ashurbanipal_flask-0.14.0.tar.gz 113.0 kB With provenance Details for ashurbanipal_flask-0.14.0.tar.gz

Built distribution (wheel)

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

Total release size: 165.5 kB

Release files / ashurbanipal_flask-0.14.0.tar.gz

Download URL ashurbanipal_flask-0.14.0.tar.gz
Size 113.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fcb5bb0e1f781ea7d7d0da2a4632249d47fd3ee7e156d63728d4093f937774b3
BLAKE2b-256 checksum
How to use checksums
3c7a3fc1d571667f5abfe85f9c1ee01ba3b7ea1c115e8fae97cc5c9dc4d2f9ca
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 14, 2026.

Transparency log

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

Download URL ashurbanipal_flask-0.14.0-py3-none-any.whl
Size 52.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd17bd0c2dcfbde9d95de7f5f2fe7af5b3135873fd8c0da56b7020bf7270e578
BLAKE2b-256 checksum
How to use checksums
2128350c72912ba724d07ca6d847e376aa2ac132f739d65e3d2ec8fa7e4a7b8b
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 14, 2026.

Transparency log

Security for ashurbanipal-flask 0.14.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.14.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 14, 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