dlt._workspace.helpers.dashboard.utils.formatters
String formatting, datetime humanization, and dict-to-table conversion utilities for the dashboard.
humanize_datetime
def humanize_datetime(dt: Union[str, int, float, datetime],
datetime_format: str) -> str
Format a datetime-like value (datetime, timestamp, or ISO string) into a human-readable string.
humanize_datetime_values
def humanize_datetime_values(c: DashboardConfiguration,
d: Dict[str, Any]) -> Dict[str, Any]
Format well-known datetime keys (started_at, finished_at, etc.) in a dict to human-readable strings.
format_duration
def format_duration(ms: float) -> str
Format a duration in milliseconds as a human-readable string (e.g. '120ms', '3.5s', '1.2m').
format_exception_message
def format_exception_message(exception: Exception) -> str
Convert a pipeline/destination exception to a user-friendly error message.
filter_empty_values
def filter_empty_values(d: Mapping[str, Any]) -> Dict[str, Any]
Return a new dict with all None and empty string values removed.
align_dict_keys
def align_dict_keys(items: List[Dict[str, Any]]) -> List[Dict[str, Any]]
Ensure all dicts in a list share the same keys, filling missing ones with '-' for uniform table rendering.
dict_to_table_items
def dict_to_table_items(d: Dict[str, Any]) -> List[TNameValueItem]
Convert a dict to a list of {name, value} dicts for display in a marimo table.