LiveDB
Real-time database previews while you code. Place your cursor on any db.* line and instantly see the query results — no need to run your app.
What It Does
Write database queries in Python using LiveDB's familiar chaining API. As you type, a preview panel shows you exactly what each query returns — live, from your actual database.
- Instant previews — place your cursor on any
db.* line, see the results
- Smart variable resolution — resolves function parameters, module constants, computed values, and
# @preview annotations automatically
- Read-only by design — impossible to modify your data through previews
- Works with PostgreSQL, MySQL, and SQLite
Quick Start
1. Install the Python package:
pip install livedb-client
2. Add a .env file in your workspace root:
LIVEDB_CONNECTION=your_database.sqlite
3. Write queries and see results:
from livedb import db
# Place your cursor here → preview shows matching users instantly
users = db.table("users").filter(f"age >= {min_age}").limit(10)
Try the Demo
Clone the demo app to see LiveDB in action with a full FastAPI project:
git clone https://github.com/sanchitwadehra/livedb-demo.git
cd livedb-demo
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python seed_db.py
Open the folder in VS Code, then place your cursor on any db.* line in app.py.
Features
- Cursor-based detection of
db.* expressions with 500ms debounce
- Multi-line expression support — chains spanning multiple lines work seamlessly
- Import alias detection —
from livedb import db as mydb works automatically
- Function parameter defaults —
async def get_users(min_age: int = 18) resolves min_age to 18
- Module constants —
LIMIT = 10 and computed values like THRESHOLD = BASE * 4 are resolved
- @preview annotations —
user_id = request.args.get("id") # @preview: 1 for dynamic values
- Table view with VS Code theme integration
Supported Databases
| Database |
Connection String |
| SQLite |
myapp.sqlite or sqlite:///path/to/db |
| PostgreSQL |
postgres://user:pass@localhost:5432/mydb |
| MySQL |
mysql://user:pass@localhost:3306/mydb |
Requirements
- Python 3.10+
- VS Code 1.85+