Hello,

I have to migrate some queries with visualizations from one redash instance to another. I tried using redash-api-client using python which helped a lot. only part I am facing some difficulty is to migrate visualization as some visualization can some complex. Is there some easy way like migrating visualization.
Below is the output of query API which gives the visualization information.

{‘is_archived’: False, ‘updated_at’: ‘2020-04-30T09:12:43.978Z’, ‘is_favorite’: False, ‘query’: ‘query text’, ‘id’: 17, ‘description’: None, ‘tags’: , ‘version’: 1, ‘query_hash’: ‘2da37f545839e6449a8f2f6883c6db9a’, ‘api_key’: ‘J16yJufkMIipyauxcaxJOsFOuUl4vJ7Qo9NMapDM’, ‘data_source_id’: 2, ‘is_safe’: True, ‘latest_query_data_id’: 5796, ‘schedule’: None, ‘user’: {‘auth_type’: ‘password’, ‘is_disabled’: False, ‘updated_at’: ‘2020-04-30T15:22:47.338Z’, ‘profile_image_url’: ‘https://www.gravatar.com/avatar/75f1ef14d4da8e4ff4e9ca4f49f2c626?s=40&d=identicon’, ‘is_invitation_pending’: False, ‘groups’: [2, 1], ‘id’: 3, ‘name’: ‘name’, ‘created_at’: ‘2020-04-06T07:12:05.415Z’, ‘disabled_at’: None, ‘is_email_verified’: True, ‘active_at’: ‘2020-04-30T15:22:05Z’, ‘email’: ‘email’}, ‘is_draft’: False, ‘can_edit’: True, ‘name’: ‘query name’, ‘created_at’: ‘2020-04-06T16:37:51.966Z’, ‘last_modified_by’: {‘auth_type’: ‘password’, ‘is_disabled’: False, ‘updated_at’: ‘2020-04-30T15:22:47.338Z’, ‘profile_image_url’: ‘https://www.gravatar.com/avatar/75f1ef14d4da8e4ff4e9ca4f49f2c626?s=40&d=identicon’, ‘is_invitation_pending’: False, ‘groups’: [2, 1], ‘id’: 3, ‘name’: ‘name’, ‘created_at’: ‘2020-04-06T07:12:05.415Z’, ‘disabled_at’: None, ‘is_email_verified’: True, ‘active_at’: ‘2020-04-30T15:22:05Z’, ‘email’: ‘email’}, ‘visualizations’:[{‘description’: ‘’, ‘created_at’: ‘2020-04-06T16:37:51.966Z’, ‘updated_at’: ‘2020-04-06T16:37:51.966Z’, ‘id’: 39, ‘type’: ‘TABLE’, ‘options’: {}, ‘name’: ‘Table’}, {‘description’: ‘’, ‘created_at’: ‘2020-04-06T16:38:29.524Z’, ‘updated_at’: ‘2020-04-08T13:29:56.713Z’, ‘id’: 41, ‘type’: ‘CHART’, ‘options’: {‘showDataLabels’: True, ‘direction’: {‘type’: ‘counterclockwise’}, ‘missingValuesAsZero’: True, ‘error_y’: {‘visible’: True, ‘type’: ‘data’}, ‘numberFormat’: ‘0,0[.]00000’, ‘yAxis’: [{‘type’: ‘linear’}, {‘type’: ‘linear’, ‘opposite’: True}], ‘series’: {‘stacking’: None, ‘error_y’: {‘visible’: True, ‘type’: ‘data’}}, ‘globalSeriesType’: ‘pie’, ‘percentFormat’: ‘0[.]00%’, ‘sortX’: True, ‘seriesOptions’: {‘Bookings’: {‘zIndex’: 0, ‘index’: 0, ‘type’: ‘pie’, ‘yAxis’: 0}}, ‘valuesOptions’: {‘8330’: {}, ‘8331’: {}, ‘8311’: {}, ‘8350’: {}, ‘8340’: {}, ‘8320’: {}}, ‘xAxis’: {‘labels’: {‘enabled’: True}, ‘type’: ‘-’}, ‘dateTimeFormat’: ‘DD/MM/YY HH:mm’, ‘columnMapping’: {‘Bookings’: ‘y’, ‘appBuild’: ‘x’}, ‘textFormat’: ‘’, ‘customCode’: ‘// Available variables are x, ys, element, and Plotly\n// Type console.log(x, ys); for more info about x and ys\n// To plot your graph call Plotly.plot(element, …)\n// Plotly examples and docs: https://plot.ly/javascript/’, ‘legend’: {‘enabled’: True}}, ‘name’: ‘Chart’}],‘options’: {‘parameters’: }}

every visualization has its own attributes. Is there way passing the above input to create visualization

We’re currently working to add a migration script to our redash-toolbelt library that does exactly. You can follow along the PR here:

As you can see it’s just an updated version of this script which is already available.

1 Like