Files
soleprint/docs/data/en/station-databrowse.md
2026-04-14 10:32:05 -03:00

81 lines
1.7 KiB
Markdown

# Databrowse
SQL data browser. Connects to a database, reads its schema from config, and provides a navigation and query interface.
**Status:** ready
---
## What It Does
Databrowse is a monitor, not a tool. It runs continuously and lets you browse database contents through a web interface. Navigate tables, inspect rows, run saved queries.
The core is generic SQL. Room configuration defines the schema and saved views.
## Structure
```
soleprint/station/monitors/databrowse/ # Core (generic SQL browser)
cfg/<room>/soleprint/station/monitors/databrowse/depot/ # Room config
```
## Configuration
Room-specific config lives in the depot directory.
### schema.json
Defines tables, fields, and relationships:
```json
{
"tables": [
{
"name": "users",
"fields": [
{"name": "id", "type": "integer", "primary": true},
{"name": "email", "type": "string"},
{"name": "created_at", "type": "datetime"}
],
"relationships": [
{"field": "id", "target": "orders.user_id", "type": "one_to_many"}
]
}
]
}
```
### views.json
Defines saved queries:
```json
{
"views": [
{
"name": "Recent Users",
"query": "SELECT * FROM users ORDER BY created_at DESC LIMIT 50"
},
{
"name": "Active Orders",
"query": "SELECT * FROM orders WHERE status = 'active'"
}
]
}
```
## Separation
Core provides:
- SQL connection handling
- Table navigation UI
- Query execution engine
- Relationship traversal
Room provides:
- `depot/schema.json` -- table definitions
- `depot/views.json` -- saved queries
- Database connection credentials
The core knows nothing about your domain. The depot tells it what to show.