Skip to main content

Markdown table workflows w/ SQLite powers ✨

Project description

floppy disk

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 ingested into SQLite backing databases on which SQL queries are actually run.

Subcommands

Subcommand Behavior
mdb pull <sql-query> process all 🌀 markers first (pulls), then outputs SQL query results in CSV format
mdb push process all 🌀 markers first (pulls), then all 💎 markers after (pushes)
mdb push <sql-mutation> process all 🌀 markers first (pulls), execute the mutation, then all 🌀 and 💎 markers after (pushes)

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:

## 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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdb_cli-0.1.0.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdb_cli-0.1.0-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file mdb_cli-0.1.0.tar.gz.

File metadata

  • Download URL: mdb_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for mdb_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fa2b964e17b988225b5bf5998be3d54f81ffa6c6adee3cb40413a91913753db4
MD5 e2de03fd654cd3b268583db5a805eb2f
BLAKE2b-256 549620e61dbee7c23a76baba689aaabd5b0047efa9482abbcd8e8d9e5c4bf119

See more details on using hashes here.

File details

Details for the file mdb_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mdb_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for mdb_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24c025f6dfcc1f904fdfc5945227727146eeb0a1eb50c80e709cf2b4bdebe326
MD5 17b4851cd35e6f93fb2f4c3a758dab6e
BLAKE2b-256 4f7ed160566deeb232364ec3353e3d191b14c338dfdeb4656bbe53a822b2b611

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page