Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>DBMD: SQL PreviewNew to Visual Studio Code? Get it now.
DBMD: SQL Preview

DBMD: SQL Preview

gandhivishal

|
557 installs
| (0) | Free
Preview SQL queries in markdown files with SQLite and DuckDB support
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

DBMD: SQL Preview for VS Code

Visual Studio Marketplace License: MIT Platform

Execute SQL queries and preview results directly in markdown files with support for SQLite and DuckDB databases.

DBMD Preview

✨ Features

  • 🎯 Native Markdown Preview Integration - Results appear inline with Cmd+Shift+V / Ctrl+Shift+V
  • 🗂️ Dual Database Support - Works with both SQLite and DuckDB
  • 🔄 Live Updates - Auto-refresh on document changes
  • 📊 HTML Table Rendering - Beautiful, styled result tables
  • 🎨 Theme-Aware - Adapts to VS Code light/dark themes
  • ⚡ Custom Preview Panel - Side-by-side view with dedicated UI
  • 🔧 Configurable - Hide/show queries, set default database types
  • 🌍 Cross-Platform - Windows, macOS, and Linux support

📦 Installation

From VS Code Marketplace

  1. Open VS Code
  2. Press Ctrl+Shift+X / Cmd+Shift+X
  3. Search for "DBMD"
  4. Click Install

From VSIX File

code --install-extension dbmd-1.0.9.vsix

Prerequisites

  • VS Code: 1.85.0 or higher
  • SQLite CLI: Pre-installed on most systems
  • DuckDB CLI (optional): See installation

🚀 Quick Start

1. Create a Markdown File

Create analysis.md:

---
database: ./data.db
dbType: sqlite
showQuery: false
---

# Sales Analysis

## Top Products

```sql
SELECT product_name, SUM(revenue) as total_revenue
FROM sales
GROUP BY product_name
ORDER BY total_revenue DESC
LIMIT 5;
```

2. Preview Results

Native Preview: Press Cmd+Shift+V (macOS) or Ctrl+Shift+V (Windows/Linux)

Custom Panel: Cmd+Shift+P → "DBMD: Preview Database Query"

📖 Usage

Frontmatter Configuration


database: ./path/to/database.db # Path to database file dbType: sqlite # 'sqlite' or 'duckdb' showQuery: false # Show/hide SQL query in output

Path Examples

Relative Paths (Recommended)

database: ./mydata.db              # Same directory
database: ./data/mydata.db         # Subdirectory
database: ../shared/mydata.db      # Parent directory

Absolute Paths

# Windows (use forward slashes)
database: C:/Users/Name/data.db

# macOS/Linux
database: /Users/name/data.db
database: /home/user/data.db

SQL Code Blocks

```sql
SELECT * FROM users WHERE active = 1;
```

Multiple queries per document supported - each renders separately.

⚙️ Configuration

Setting Description Default
dbmd.defaultDatabaseType Default database type sqlite

Access via: File → Preferences → Settings → Search "DBMD"

📚 Examples

The examples/ directory contains Chinook database examples (industry-standard music store with 11 tables, 275 albums, 3,503 tracks).

SQLite (chinook_example.md): Sales analysis, customer insights, aggregations
DuckDB (chinook_duckdb_example.md): Window functions, statistical analysis, time-series

Try it: Press F5 → Open example file → Cmd+Shift+V

🌍 Platform Support

Platform SQLite DuckDB
Windows ✅ Pre-installed ⚡ Optional
macOS ✅ Pre-installed ⚡ Optional
Linux ✅ Usually included ⚡ Optional

Installing DuckDB (Optional)

# Windows
winget install DuckDB.cli

# macOS
brew install duckdb

# Linux
sudo apt install duckdb

🔧 Development

git clone https://github.com/ivishalgandhi/dbmd.git
cd dbmd
npm install

# Test: Press F5 in VS Code to launch Extension Development Host

🐛 Troubleshooting

Database File Not Found
→ Use forward slashes in paths: C:/path/to/db
→ Save markdown file before previewing

Tables Not Rendering
→ Reload window: Cmd+R / Ctrl+R
→ Check Developer Console: Help → Toggle Developer Tools
→ Verify CLI: sqlite3 --version, duckdb --version

CLI Tool Not Found
→ Install SQLite/DuckDB (see Platform Support)

📜 License

MIT License - see LICENSE

🙏 Acknowledgments

  • VS Code Extension API
  • markdown-it
  • Chinook Database

Issues: GitHub | Marketplace: VS Code Marketplace

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft