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.
The original migrator.py
is here: https://gist.github.com/arikfr/e1c01f6c04d8348da52f33393b5bf65d
Suggested migrator.py
is here: https://gist.github.com/chintanp/19ba9fb994f49327725e22639d230328
Change summary:
- 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 thedashboards
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:
-
Run this script like so:
python migrator.py
from a directory with write privileges. This script creates a filemeta.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/migrator.py
will not work as is, as themeta.json
will be saved in the other directory andmigrator.py
will not be able to find it. -
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 themeta
object inmigrator.py
does not work. I had to delete the meta.json and then re-run the migrator.py to make mymeta
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.
Thanks