DataLens - Database Viewer Pro

A powerful, all-in-one database client for Visual Studio Code. Browse schemas, execute queries, edit data, visualize charts, and manage 15+ databases — all without leaving your editor.
Supported Databases (15)
| Database |
Status |
Driver |
| SQLite |
Full support |
sql.js (WASM) |
| PostgreSQL |
Full support |
pg |
| MySQL |
Full support |
mysql2 |
| MariaDB |
Full support |
mysql2 |
| SQL Server |
Full support |
tedious |
| Oracle |
Full support |
oracledb |
| CockroachDB |
Full support |
pg |
| MongoDB |
Full support |
mongodb |
| Redis |
Full support |
ioredis |
| Cassandra |
Full support |
cassandra-driver |
| Neo4j |
Full support |
neo4j-driver |
| ClickHouse |
Full support |
@clickhouse/client |
| DynamoDB |
Full support |
@aws-sdk |
| Elasticsearch |
Full support |
@elastic/elasticsearch |
| Firestore |
Full support |
firebase-admin |
What's New in 2.1.0
- SQL Notebooks — create
.sqlnb notebooks that mix Markdown and runnable SQL cells, with rich table outputs. Each notebook remembers which connection it runs against (DataLens: New SQL Notebook).
- ERD diagrams — an interactive entity-relationship diagram of any connected database, with primary/foreign keys, auto-layout, pan/zoom and a minimap (ERD tab in the query panel, or right-click a connection → Show ERD Diagram).
- Run
.sql files directly — CodeLenses on every statement in a .sql file execute against a chosen connection, with results in the DataLens grid.
- MCP server for AI agents — DataLens exposes
list_connections, get_schema and run_sql as a Model Context Protocol server, so MCP-capable agents (e.g. Copilot agent mode) can safely explore and query your databases. Read-only by default; writes require an explicit setting plus in-editor confirmation.
- Status bar connection indicator — see the active connection at a glance; production connections get a warning badge. Click for quick connect/disconnect/query/notebook/ERD actions.
Features
Connection Management
- Add connections via form or connection URI
- Auto-discover connections from
.env files in your workspace
- Organize connections into groups
- SSH tunnel support for remote databases
- SSL/TLS support with certificate configuration
- Connection pooling with configurable limits
Schema Browser
- Tree view in the sidebar showing databases, tables, views, columns, indexes
- Foreign key relationships displayed inline
- Stored procedures, triggers, and views
- Schema comparison between two connections
- Copy table names and generate SELECT/INSERT templates from context menu
Query Editor
- Full SQL editor powered by Monaco (same editor as VS Code)
- Schema-aware autocomplete with table and column names — resolves table aliases across FROM/JOIN and understands CTEs
- SQL formatting and syntax highlighting
- Multi-statement execution (run statement at cursor or all)
- Snippet picker with common query templates
- Query history with one-click re-run
- SQL lint warnings displayed inline
SQL Notebooks & .sql Files
- SQL Notebooks (
.sqlnb) — mix Markdown and runnable SQL cells with rich table outputs; each notebook remembers which connection it runs against
- Run
.sql files — CodeLenses on every statement ("Run statement", "Run all") execute workspace SQL scripts against a chosen connection
- Results always open in the full DataLens grid, and every statement passes the destructive-query guardrails
Results Panel
- Sortable, filterable data grid with pagination
- Column visibility toggles
- Per-column type-aware filtering (text, number, date, boolean)
- Row detail expansion for inspecting long values
- Inline cell editing with Enter to save
- Context menu: Copy Value, Copy Row as JSON, Copy as INSERT
- Virtual scrolling for large result sets
Data Export & Import
- Export to CSV, JSON, SQL INSERT statements, Markdown, Excel
- Import from CSV with preview mode
- Configurable delimiters and encoding
Visualization
- Built-in chart panel: Bar, Line, Pie, Area, Scatter, Donut
- Multi-series Y axis support
- Data aggregation toolbar (Group By + SUM/AVG/COUNT/MIN/MAX)
- Export charts as SVG
- Query plan visualization with cost-colored tree nodes
Data Editing
- Insert, update, and delete rows through the UI
- Type-aware form controls (boolean toggle, date picker, JSON editor, textarea)
- Transaction support with commit/rollback controls
- Isolation level selector
- Long-running transaction warnings
AI-Powered Features
- Natural language to SQL conversion
- Agent mode — give the AI a goal and it plans, runs SQL step-by-step, reads the results, and refines until done. Steps stream live, and you can insert any generated query into the editor.
- Query optimization suggestions
- Providers: GitHub Copilot (no API key — reuses your Copilot subscription, incl. its Claude/GPT/Gemini models), OpenAI, Anthropic, and Ollama
@datalens in Copilot Chat — ask questions about your active connection right in the chat panel; DataLens runs the agent against your DB and streams each step
- Language-model tools (
run_sql, get_schema) — usable from Copilot agent mode so the assistant can query your database
- MCP server — DataLens registers a Model Context Protocol server (
list_connections, get_schema, run_sql) so any MCP-capable agent in VS Code can explore and query your databases
- Safe by default — the agent is read-only unless you enable
dbViewer.ai.agentAllowWrites, and every statement it runs passes through the same destructive-operation guardrails as manual queries
Additional Features
- Light, dark, and system theme support
- Interactive ERD (Entity Relationship Diagram) with auto-layout, pan/zoom and minimap
- Status bar connection indicator with quick actions (production connections get a warning badge)
- Destructive-query guardrails: production connections require a typed confirmation for irreversible operations
- Getting-started walkthrough on first launch
- Mock data generation based on column types
- Database monitoring (connections, size, cache stats)
- Backup and restore (SQL dump)
- DDL generation
- Data masking for sensitive columns
- Global search across all connected databases
- Keyboard shortcuts throughout
Getting Started
- Install the extension from the VS Code Marketplace — a guided walkthrough opens on first launch
- Open the DataLens panel from the Activity Bar (database icon)
- Click the + button to add a connection
- Select your database type, enter credentials, and connect
- Browse your schema, click a table to view data, or open a new query tab
Quick Connect via URI
Use the DataLens: Add Connection from URI command to paste a connection string:
postgresql://user:pass@localhost:5432/mydb
mysql://user:pass@localhost:3306/mydb
mongodb://user:pass@localhost:27017/mydb
redis://localhost:6379
Auto-Discovery
DataLens automatically scans .env files in your workspace for database connection strings (DATABASE_URL, MONGO_URI, REDIS_URL, etc.) and offers to add them as connections.
Keyboard Shortcuts
| Shortcut |
Action |
Ctrl+Enter / Cmd+Enter |
Execute selection or statement at cursor |
Ctrl+Shift+Enter |
Execute all statements |
Ctrl+Shift+F |
Format SQL |
Ctrl+1 / Ctrl+2 / Ctrl+3 / Ctrl+4 |
Switch view: Data / Chart / Plan / ERD |
Ctrl+R |
Refresh table data |
Ctrl+T |
New query tab |
Ctrl+W |
Close tab |
Escape |
Cancel inline edit |
Extension Settings
| Setting |
Default |
Description |
dbViewer.maxRows |
1000 |
Maximum rows to fetch per query |
dbViewer.queryTimeout |
30000 |
Query timeout in milliseconds |
dbViewer.confirmDelete |
true |
Confirm before deleting rows |
dbViewer.autoDiscover |
true |
Auto-discover connections from .env |
dbViewer.ai.provider |
openai |
AI provider (copilot, openai, anthropic, ollama) — copilot needs no API key |
dbViewer.ai.apiKey |
|
API key for AI features |
dbViewer.ai.model |
|
Model name for AI features |
dbViewer.ai.agentMaxSteps |
8 |
Max steps the AI agent may take |
dbViewer.ai.agentAllowWrites |
false |
Allow the AI agent to run write/DDL statements |
dbViewer.dataMasking.enabled |
false |
Enable sensitive data masking |
dbViewer.schemaCacheTTL |
60000 |
Schema cache duration (ms) |
dbViewer.security.storePasswords |
true |
Persist passwords in SecretStorage (off = prompt on connect) |
dbViewer.guardDestructiveQueries |
true |
Confirm before destructive statements |
Requirements
- VS Code 1.125.0 or later
- GitHub Copilot (optional) — only needed for the
copilot AI provider and the @datalens chat participant
- Database-specific drivers are bundled with the extension (no additional installation needed for SQLite, PostgreSQL, MySQL, MariaDB, SQL Server, MongoDB, Redis, etc.)
- Oracle requires the Oracle Instant Client installed on your system
- DynamoDB requires AWS credentials configured
- Firestore requires a Firebase service account key
Support
If you find DataLens useful, consider buying me a coffee!

Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
MIT - Copyright (c) 2026 Sitharaj Seenivasan
| |