My company would like to export queries and visualisations from Redash instance A and import them into Redash instance B. Basically just shifting all queries and visualisation from one account to another account.
I have managed to export all queries into sql files on my local desktop. But how do I import them back into another account? Is it possible to bring visualisations and the dashboard over too?
The script given in GitHub didn’t work.
Extra qn: I used the given python export script and it exports all of my 100 plus queries. How do I limit and choose only those that I would like to export, lets say by favourites or by query number or title.
I’m getting response error 404. What i’m guessing is that there has to be a query with the same query number in order to import? I am testing with 70 queries and the new account has 0 queries created.
Is it because it is only possible to import back to the same account you exported from?
Is it possible to import to a whole new account?
I’m trying to upload an sql file that i download with the save_queries
I’m using the upload_queries with the same url and api_key from the save function.
I’m getting 200 ok but can’t see any new file in my queries page.
def upload_queries(url, api_key):
headers = {'Authorization': 'Key {}'.format(
api_key), 'Content-Type': 'application/json'}
# Retrieves all files in directory
files = [f for f in os.listdir('./')]
# files = [f for f in os.listdir('./') if os.path.isfile(f)]
for f in files:
if f.startswith('query_') and f.endswith('.sql'):
print(f)
start = f.index('_') + 1
end = f.index('.')
query_id = f[start:end]
path = "{}/api/queries/{}".format(url, query_id)
query_content = get_query_content(f)
query_info = {'query': query_content, 'id': int(query_id)}
print(query_info)
response = requests.post(
path, headers=headers, data=json.dumps(query_info))
print(response)
def get_query_content(filename):
query = ''
#Reading contents in file
with open("./"+filename, 'r') as f:
#Reads until EOF
lines = f.readlines()
for i in range(7, len(lines)):
query += lines[i]
return query
Hi ,
is there a full example how to export and import queries ,dashboards, users from Redash instance A to Redash instance B at on prem docker installation ?
Hanan
1 Like
Login or sign up disabled while the site is in read only mode