How to migrate from Hosted Redash to Localhost?

I had to update the provided script to perform the migrations. Works with Python 3.7.7 on Windows 10 from within WSL 2 terminal.

The original is here:
Suggested is here:

Change summary:

  1. Updated the print statements to be Python 3 compatible.
  2. Added comments in the code to explain how to get the IDs (data source IDs, user IDs etc.)
  3. Updated the import_dashboards() code as the dashboards object definition seems to have changed, making the inner for-loop un-necessary.

The new script worked pretty well and fast for me, but I had less than 10 queries and 1 dashboard to import. Others can post their performance results.

Some gotchas:

  1. Run this script like so: python from a directory with write privileges. This script creates a file meta.json to store the migration state, so as to avoid repeating any migration. Running the script from another folder messes up the path, so for example, python ./somewhere_else/ will not work as is, as the meta.json will be saved in the other directory and will not be able to find it.

  2. I made a mistake originally in entering the fields in the meta object on Line 27 of the new script. This resulted in a “wrong” meta.json file, which is later used as the “meta” source, so updating the meta object in does not work. I had to delete the meta.json and then re-run the to make my meta object changes to take effect. Of course, none of the migrations had happened for me, so my meta.json was bare-bones.

Pro tip: Use VS Code with the Python extension to debug the script.

The one issue with the migration process it that the parameters are not migrated. So none of my visualizations worked as they were dependent on parameters. I had to manually create the parameters in all queries for the visualizations and dashboards to work.

Still lot of effort saved, and totally worth it. Thanks again Redash team for awesome work.


1 Like