Update Dashboard Widget
Update a widget’s fields within this dashboard, using copy-on-write for shared widgets.
If the widget belongs only to this dashboard it is updated in place; if it is
referenced by more than one dashboard, a new widget is created with the updates
applied and swapped into this dashboard’s widget_order, leaving the other
dashboards’ copy untouched. The widget must already be in this dashboard’s
widget_order, otherwise the call is rejected. The result is recomputed
synchronously when the query changes or when the widget was cloned; otherwise the
existing cached result is returned. For table widgets, conditional-formatting
column references are re-resolved against the (possibly updated) query on each save.
The dashboard must exist and not be archived.
Update Dashboard Widget
import os
from scale_gp_beta import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
evaluation_dashboard_widget_with_result = client.evaluation_dashboards.widgets.update(
widget_id="widget_id",
dashboard_id="dashboard_id",
)
print(evaluation_dashboard_widget_with_result.id){
"id": "id",
"account_id": "account_id",
"created_at": "2019-12-27T18:11:19.117Z",
"title": "title",
"type": "bar",
"config": {
"foo": "bar"
},
"object": "evaluation_widget",
"query": {
"select": [
{
"expression": {
"column": "column",
"source": "source",
"type": "COLUMN"
},
"alias": "alias"
}
],
"evaluation_ids": [
"string"
],
"filter": {
"conditions": [
{
"column": "column",
"operator": "=",
"source": "source",
"value": "string"
}
],
"logicalOperators": [
"AND"
]
},
"groupBy": [
"string"
],
"latest_only": true,
"limit": 1,
"orderBy": [
{
"column": "column",
"direction": "ASC",
"source": "source"
}
]
},
"result": {
"id": "id",
"computation_status": "computation_status",
"widget_id": "widget_id",
"computed_at": "2019-12-27T18:11:19.117Z",
"computed_result": {
"foo": "bar"
},
"error_message": "error_message"
}
}Returns Examples
{
"id": "id",
"account_id": "account_id",
"created_at": "2019-12-27T18:11:19.117Z",
"title": "title",
"type": "bar",
"config": {
"foo": "bar"
},
"object": "evaluation_widget",
"query": {
"select": [
{
"expression": {
"column": "column",
"source": "source",
"type": "COLUMN"
},
"alias": "alias"
}
],
"evaluation_ids": [
"string"
],
"filter": {
"conditions": [
{
"column": "column",
"operator": "=",
"source": "source",
"value": "string"
}
],
"logicalOperators": [
"AND"
]
},
"groupBy": [
"string"
],
"latest_only": true,
"limit": 1,
"orderBy": [
{
"column": "column",
"direction": "ASC",
"source": "source"
}
]
},
"result": {
"id": "id",
"computation_status": "computation_status",
"widget_id": "widget_id",
"computed_at": "2019-12-27T18:11:19.117Z",
"computed_result": {
"foo": "bar"
},
"error_message": "error_message"
}
}