Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Database notebookNew to Visual Studio Code? Get it now.
Database notebook

Database notebook

H.Yoshioka

|
4,963 installs
| (3) | Free
Turn ad-hoc investigations across databases, logs, and cloud resources into something you can save, share, and re-run. Manage SQL, JavaScript/TypeScript, and Markdown together in one notebook file, with a database manager for MySQL, PostgreSQL, SQL Server, SQLite, Oracle, Redis, Memcached, AWS, Keyc
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Database Notebook

日本語

logo

Database Notebook brings SQL, JavaScript/TypeScript, Markdown, and query results together in one notebook file, so you can turn ad-hoc investigations across databases, logs, and cloud resources into something you can save, share, and re-run.

What it's for

  • Investigate incidents across databases, logs, and cloud resources — Query production and staging databases, inspect CloudWatch logs, and scan AWS resources (S3, SQS, DynamoDB, Secrets Manager, SSM) — all from the same notebook, so the whole investigation stays in one reusable file.
  • Keep SQL, JavaScript, Markdown, and results in one reusable file — Mix SQL, JavaScript/TypeScript, shell, and Markdown cells with variables shared between them, then export the results as HTML or Excel. See Database Notebook file examples.
  • Diagnose and improve slow SQL (Experimental) — Collect execution plans, table statistics, indexes, and physical-health signals together, then use the evidence to investigate bottlenecks — and compare a saved report from before your change against the current one to see exactly what moved. See the Performance Tuning Guide.
  • Reuse your saved connections from GitHub Copilot Chat / MCP clients — The same connections you set up in the DB Explorer are available as AI tools in Copilot Chat (Agent mode), and via a standalone MCP server for other MCP clients (Claude Code, Claude Desktop, Cursor, ...). See AI Tools Usage Guide.

Quickstart (3–5 min)

No external database needed — this uses a small local SQLite file.

  1. Install the extension.
  2. Open the Command Palette and run Database Notebook: Create SQLite Demo. This creates a small local SQLite database, a connection pointing at it, and a ready-to-run .dbn notebook.
  3. Run the notebook with Run All.
  4. Check the query result and the chart it generates.
  5. Save the result as an HTML or Excel file from the result panel's toolbar.
  6. When you're ready, create your own connection from the DB Explorer side panel and point your notebooks at it.

Supported databases & resources

MySQL, PostgreSQL, SQL Server, SQLite, Oracle, Redis, Memcached, AWS, Keycloak, Auth0, MQTT

Detailed features

  • Mix SQL, JavaScript/TypeScript (Node.js), shell/batch script, Redis/Memcached command, and Markdown cells in a single notebook file
    • Shell script cells (shellscript: bash/sh/zsh) run and capture stdout/stderr like any other cell; Windows batch cells (bat) are also supported but experimental (not verified end-to-end on Windows)
    • Shell script and batch cells can read shared variables from preceding cells as DB_NOTEBOOK_VAR_<name> environment variables ($DB_NOTEBOOK_VAR_name / %DB_NOTEBOOK_VAR_name%): Use shared variables in shellscript/bat cells
    • Redis/Memcached command cells (redis/memcached) run one raw command per cell (e.g. GET mykey, HGETALL myhash) against a saved connection and return a tabular (RDH) result, the same as SQL cells, instead of plain text
    • Share variables between cells, including passing a SQL cell's result set into a later JavaScript cell for further processing
    • See a full SQL → JavaScript → Markdown walkthrough: Database Notebook file examples
    • See Redis/Memcached command cell examples: Database Notebook Redis/Memcached command cell examples
  • Access databases through Notebooks, Sidebars, and panel UIs
  • Dashboards (Experimental)
    • Inspect live database statistics for MySQL, PostgreSQL, SQL Server, SQLite, and Oracle, or CloudWatch metrics for supported AWS resources, directly from the DB Explorer.
    • Start/stop database sampling, refresh CloudWatch metrics, switch dashboard views, and export the collected snapshot to a read-only .dbnr report.
    • This feature is experimental: available panels and metrics depend on the database version, permissions, endpoint, and AWS metric configuration, and the UI/report format may change.
    • Dashboard Guide
  • Execute SQL mode
    • Execute query (Default)
    • Execute explain plan (Generates a query plan).
    • Execute explain analyze (Displays actual execution time and statistics)
  • Query history management
  • Variable sharing between notebook cells
    • See practical SQL examples using shared variables (LIKE, IN, exact match): Variable sharing – LIKE and IN examples
  • Generate ER diagrams in mermaid format or as an editable draw.io diagram
  • Generate Mermaid or editable draw.io diagrams from CloudFormation stacks
    • CloudFormation Diagram Guide
  • Count all tables in the schema
  • Provide IntelliSense with database resource names and comments
  • Intuitive visualization of result sets
    • Difference display using comparison key (Primary or Unique key)
    • Label display using code label resolver
    • Verify result sets comply with a rule.
    • Output in Excel file format
    • Generate descriptive statistics
    • Support graphs
  • Create and execute SQL statements to undo changes
  • Export notebook as an HTML file
  • File preview
    • CSV file preview
    • Har file preview
  • MQTT Client
    • Intuitive publish/subscribe interface
    • Query subscribed payloads using SQLite directly from the notebook
  • Parse SQL log

Screenshots

  • Setup connection settings, access to Mysql through the Side-panel

  • Access to Mysql through the Notebook ( Create a new blank Database Notebook )

  • Variable sharing between notebook cells

  • Export notebook as an HTML file

  • ER diagram creation

  • Execute SQL mode

    • Execute query (Default)
    • Execute explain plan (Generates a query plan).
    • Execute explain analyze (Displays actual
  • Format SQL statement

  • Count all tables in the schema

  • Create DB Notebook from an sql file

  • Access to Aws( DynamoDB ) through the Notebook

    • On the DB Notebook, specify the number of counts in the LIMIT clause
  • MQTT Client

    • Database Notebook file MQTT examples
Screenshots ( Intuitive visualization of result sets ) ( Click here )

Difference display using comparison key (Primary or Unique key)

  • Create and execute SQL statements to undo changes

Label display using code label resolver ( Create a new blank Code label resolver )

Verify records comply with a rule ( Create a new blank DB record rule )

Generate descriptive statistics

Screenshots ( Access to the Keycloak from the side panel ) ( Click here )

Access to the Keycloak from the side panel to display changes in user information.

Expand and display JSON items in columns.

Screenshots ( File viewer ) ( Click here )

Csv file viewer

  • After previewing the CSV file, descriptive statistics were displayed according to its content.

Har file viewer

SQL Log Parse Feature

The Log Parse feature analyzes application logs and extracts structured SQL execution data.

  • Log Parser Usage Guide

AI / MCP

  • Use Database Notebook's connections as AI tools in GitHub Copilot Chat (Agent mode)
    • List/test connections, inspect schema, run queries & transactions, scan non-SQL resources (Redis, Memcache, MQTT, Keycloak, Auth0, AWS), and create/edit .dbn notebooks — all reusing the credentials you've already saved
    • AI Tools Usage Guide
  • Run a standalone MCP server so supported external MCP clients (Claude Code, Claude Desktop, Cursor, ...) can use the same connections outside VS Code
    • MCP Server Usage Guide
    • The local MCP server has been verified with ChatGPT Work and Codex. ChatGPT's regular Chat mode does not expose these tools in the tested setup; see the usage guide for client-specific limitations.

Reference & samples

  • Database Notebook file examples
  • Database Notebook file chart examples
  • Database Notebook file Javascript cell examples
  • Database Notebook file MQTT examples
  • Dashboard Guide (Experimental)
  • Database Notebook file Variable sharing – SQL examples (LIKE / IN / exact match)
  • Performance Tuning Guide (Experimental)
  • Log Parser Usage Guide
  • Connecting to SQL Server with Entra ID (Azure AD) authentication
  • Using Database Notebook's AI Tools from GitHub Copilot Chat
  • Using Database Notebook's AI Tools via a Standalone MCP Server

Tips

  1. Instead of using VS Code's built-in Copy Cell or + Code / Add Code Cell, I recommend using Duplicate Cell with Metadata. This action copies not only the cell content, but also all associated metadata—such as database connection settings and ResultSet decoration options—so you can add a new cell without reconfiguring these settings.
  2. You can specify a default connection definition each time you add a new SQL cell to the notebook

Keyboard shortcuts

You can open this editor by going to the menu under Code > Settings > Keyboard Shortcuts or by using the Preferences: Open Keyboard Shortcuts command (⌘K ⌘S).

Command Keybindings When Source
Mark cell as skip or not ctrl+alt+s notebookType == 'database-notebook-type' && notebookCellListFocused && notebookCellType == 'code' Database notebook
Specify connection to use ctrl+alt+c notebookType == 'database-notebook-type' && notebookCellListFocused && cellLangId == 'sql' Database notebook
Notebook: cell execution ctrl+enter - System (default)

Requirements

  • node.js >= 18

Recommended Extensions

When you generate an ER diagram in Mermaid format (the alternative is an editable draw.io diagram), it's rendered inside a preview notebook. It is recommended to use the "Markdown Preview Mermaid Support" extension together to visualize it.

🎁 Donate

Buy Me A Coffee
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft