Markdown table workflows w/ SQLite powers ✨
Project description
mdb-cli
Markdown table workflows w/ SQLite powers ✨
mdb-cli provides the mdb command-line tool to make markdown tables data-driven and queryable via SQL, using specialized co-located markers 💾 ... with some embedded inline SQL queries to define and dynamically view our project-level data.
- Zero runtime dependencies -- standard library only
- Simple integration -- add markers and get running
- Python 3.11+ required
Installation
Install from PyPI:
# Using pipx (recommended)
pipx install mdb-cli
# Using uv (recommended)
uv tool install mdb-cli
# Using pip
pip install mdb-cli
After installation, verify the tool is available:
mdb --help
For development installation, see CONTRIBUTING.md.
Basic Usage
Marker Syntax
Place inline query markers above tables in your markdown file using the following format:
`💾 [scope] <directive> <sql-query>`
| Component | Description |
|---|---|
💾 |
Marker prefix -- identifies the line as an mdb marker |
[scope] |
Optional named scope identifier of the dataset |
<directive> |
Directive: 🌀 (feed) or 💎 (tap) |
<sql-query> |
SQL query to execute against the dataset |
Directives
| Directive | Name | Instruction |
|---|---|---|
🌀 |
feed | Include the table below me as part of the dataset |
💎 |
tap | Execute my SQL query on the dataset and render the results as the table below me (table auto-generated if absent) |
Under the hood, datasets are dynamically backed by SQLite databases on which SQL queries are actually run 🚀
Subcommands
| Subcommand | Behavior |
|---|---|
mdb push |
process all 🌀 markers first (pulls), then all 💎 markers after (pushes) — reports only changed markers by default |
mdb push <sql-mutation> |
process all 🌀 markers first (pulls), execute the mutation, then all 🌀 and 💎 markers after (pushes) |
mdb pull <sql-query> |
process all 🌀 markers first (pulls), then outputs SQL query results in CSV format |
mdb status |
inspects all 🌀 and 💎 markers, then reports metadata and warnings |
Example
Given a project file snacks.md with the following content:
# Snacks
## Inventory
`💾 🌀 SELECT * FROM snacks`
| name | vibe | qty |
| ------------------ | ------------------ | --- |
| Hot Cheese Popcorn | chaos energy | 3 |
| Pocky | elegant simplicity | 12 |
| Takis | rolled-up danger | 7 |
| Goldfish | the people's snack | 41 |
## Low stock
`💾 💎 SELECT name, qty FROM snacks WHERE qty < 10 ORDER BY qty`
After running:
mdb push
We'll have the snacks.md updated to the following content:
# Snacks
## Inventory
`💾 🌀 SELECT * FROM snacks`
| name | vibe | qty |
| ------------------ | ------------------ | --- |
| Hot Cheese Popcorn | chaos energy | 3 |
| Pocky | elegant simplicity | 12 |
| Takis | rolled-up danger | 7 |
| Goldfish | the people's snack | 41 |
## Low stock
`💾 💎 SELECT name, qty FROM snacks WHERE qty < 10 ORDER BY qty`
| name | qty |
| ------------------ | --- |
| Hot Cheese Popcorn | 3 |
| Takis | 7 |
The 🌀 (feed) marker ingests the snacks data into the (unscoped) dataset, then the 💎 (tap) marker executes the query and surfaces only the snacks running low in stock.
Additionally, after running:
mdb pull "SELECT SUM(qty) as total_snacks FROM snacks"
We'll get the output:
total_snacks
63
The 🌀 (feed) marker again ingests the snacks data into the dataset, but the 💎 (tap) marker is not processed.
We can also mutate data directly. Running:
mdb push "UPDATE snacks SET qty = qty + 20 WHERE name = 'Takis'"
The 🌀 (feed) marker again ingests the snacks data into the dataset, applies the UPDATE, then both 🌀 (feed) and 💎 (tap) markers push fresh results back out.
So then in the updated snacks.md:
## Inventory
`💾 🌀 SELECT * FROM snacks`
| name | vibe | qty |
| ------------------ | ------------------ | --- |
| Hot Cheese Popcorn | chaos energy | 3 |
| Pocky | elegant simplicity | 12 |
| Takis | rolled-up danger | 27 |
| Goldfish | the people's snack | 41 |
## Low stock
`💾 💎 SELECT name, qty FROM snacks WHERE qty < 10 ORDER BY qty`
| name | qty |
| ------------------ | --- |
| Hot Cheese Popcorn | 3 |
Takis got restocked to 27 and dropped off the low-stock list — all from a single command.
We can also inspect the current landscape of markers. Running:
mdb status
We'll get a snapshot of the available data:
OK 🌀 snacks (3 cols, 4 rows) [snacks.md:5]
OK 💎 SELECT name, qty FROM snacks WHERE qty < 10 ORDER BY qty (2 cols, 2 rows) [snacks.md:15]
Inspected 1 files, 2 markers: 0 problems
🌀 (feed) and 💎 (tap) markers show table dimensions, query text — and any problems (missing tables, conflicts) are flagged.
Agent Support
mdb-cli includes a built-in agent skill. Install it:
mdb init # default: .mdb/skills/mdb/SKILL.md
mdb init .claude/skills # Claude Code: .claude/skills/mdb/SKILL.md
mdb init .opencode/skills # OpenCode: .opencode/skills/mdb/SKILL.md
mdb init path/to/agent/skills # any agent: path/to/agent/skills/mdb/SKILL.md
Within a session, invoke the /mdb slash command to access a comprehensive reference covering marker syntax, subcommand workflows, templates for common operations, and an error reference guide. The skill provides everything an AI coding assistant needs to construct and debug mdb markers without leaving the editor.
Configuration
mdb init also generates a .mdbrc configuration file in the project root. Edit it to set project-level defaults for CLI flags (include, compaction, verbose). CLI flags always override .mdbrc values. See CLI Usage for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mdb_cli-0.1.1.tar.gz.
File metadata
- Download URL: mdb_cli-0.1.1.tar.gz
- Upload date:
- Size: 30.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e35858072e4317eeb64e485b73ce03592d81546e9f1ca507c66f50a6c577b6c6
|
|
| MD5 |
f3c1a9fb781c5b92800192806b56b74c
|
|
| BLAKE2b-256 |
70f69187e411a4faa9b2bef1f0bc33d55282c2b34c516719774e86d148234927
|
File details
Details for the file mdb_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mdb_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 33.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9aa51e2d895632906546b804f1cabcd9bbb87ba10349b669f0257d2b7d05afa6
|
|
| MD5 |
b9ac693e5ab6b873998261bccd669c30
|
|
| BLAKE2b-256 |
f8652213e8828d3e1f8397620cd5aa8a50010c4dc9292f05be988422ec81c463
|