I had to update the provided
migrator.py script to perform the migrations. Works with Python 3.7.7 on Windows 10 from within WSL 2 terminal.
migrator.py is here: https://gist.github.com/arikfr/e1c01f6c04d8348da52f33393b5bf65d
migrator.py is here: https://gist.github.com/chintanp/19ba9fb994f49327725e22639d230328
- Updated the print statements to be Python 3 compatible.
- Added comments in the code to explain how to get the IDs (data source IDs, user IDs etc.)
- Updated the
import_dashboards()code as the
dashboardsobject 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.
Run this script like so:
python migrator.pyfrom a directory with write privileges. This script creates a file
meta.jsonto 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/migrator.pywill not work as is, as the
meta.jsonwill be saved in the other directory and
migrator.pywill not be able to find it.
I made a mistake originally in entering the fields in the
metaobject 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
migrator.pydoes not work. I had to delete the meta.json and then re-run the migrator.py to make my
metaobject 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.