superset-api-client
superset-api-client copied to clipboard
Chart save method keeps getting the same error
Code: from supersetapiclient.client import SupersetClient
def rename_chart(slice_id, superset_client):
try:
chart = superset_client.charts.get(slice_id)
print(chart)
except:
print(f"Chart with ID '{slice_id}' not found.")
return
new_name = f"TO BE DEPRECATED SOON - {chart.slice_name}"
chart.slice_name = new_name
chart.save()
if __name__ == "__main__":
superset_client = SupersetClient(
host="https://superset.X.net/",
username="admin",
password="",
)
chart_id_to_rename = 778 # Update this with the chart ID you want to test
rename_chart(chart_id_to_rename, superset_client)
Response:
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/supersetapiclient/base.py", line 45, in raise_for_status
raise BadRequestError(*e.args, request=e.request, response=e.response, message=error_msg) from None
supersetapiclient.exceptions.BadRequestError: {
"dashboards": {
"0": [
"Not a valid integer."
]
}
}