Persist Dashboards¶
FlowDash uses SQLite to store dashboard configurations: which components are
placed, how they are connected, and their grid layout. The DashboardStore
handles all CRUD operations.
Create a store¶
The database file is created automatically with the required schema. WAL mode is enabled for concurrent read access.
Dashboard data model¶
A persisted dashboard consists of three parts:
DashboardItem¶
Each placed component instance:
from panel_flowdash import DashboardItem
item = DashboardItem(
instance_id="filter_1",
component_id="Analytics/filter",
x=100, # ReactFlow canvas x position
y=200, # ReactFlow canvas y position
config={}, # Instance-specific configuration
)
x and y store the node editor canvas position. Grid layout (widths,
heights, visibility) is stored separately in tile_layout.
DashboardEdge¶
Each connection between component ports:
from panel_flowdash import DashboardEdge
edge = DashboardEdge(
source="filter_1",
source_port="filtered",
target="chart_1",
target_port="data",
)
DashboardModel¶
The complete dashboard:
from panel_flowdash import DashboardModel
model = DashboardModel(
dashboard_id="abc123",
user_id="user@example.com",
title="My Dashboard",
items=[item],
edges=[edge],
tile_layout=[
{"id": "filter_1", "w": 4, "h": 3, "x": 0, "y": 0},
{"id": "chart_1", "w": 8, "h": 4, "x": 4, "y": 0},
],
)
The tile_layout list stores the grid positions and sizes for the rendered
dashboard view (separate from the node editor canvas positions in items).
CRUD operations¶
Create¶
Generates a random dashboard ID and persists an empty dashboard.
Load¶
Returns None if not found.
List¶
Returns all dashboards for a user, ordered by most recently updated.
Save¶
Uses upsert semantics (INSERT ... ON CONFLICT DO UPDATE).
Rename¶
Delete¶
Returns True if a row was deleted, False if not found.