Internal visualization db schema

How does Redash store query visualization definitions internally? If I want to generate dashboards programmatically, could I write to Redash’s db directly?

It’s all written to the widgets table in the metadata db. You can write to this table directly but I wouldn’t recommend it. We don’t maintain any documentation of this API as it’s not really for human consumption :confused:

What you could do is design your dashboards with the UI and then copy the widget definitions with minor modifications (labels, colours, plot types … ) which would be less of a minefield.

1 Like

Thank you.

How does one connect to the metadata DB in the downloadable AWS image from ?

What code read from / writes to the widgets table?

The passwords for the metadata db are written to the environment variables of your docker containers / Dockerfile. It will be different from one instance to the next.

There’s a widget resource handler. But that’s really unimportant. Because the widget JSON is basically taken wholesale from the front-end POST request and committed to the database. It doesn’t go through any transformations. So what you really want to see is the front-end code that reads / writes visualisation definitions.

Like I said: not really for human consumption.