Skip to content

Commit

Permalink
[RT] Misc Fixes (#118)
Browse files Browse the repository at this point in the history
- Don't halt fixing qrds refs if a bad ref is found
- Fix: the check for an app.redash.io ORIGIN was incorrect
  • Loading branch information
Jesse authored Nov 17, 2021
1 parent 1cc98c0 commit ef6e548
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "redash_toolbelt"
version = "0.1.8"
version = "0.1.9"
description = "Redash API client and tools to manage your instance."
authors = ["Redash Maintainers"]
license = "BSD-2-Clause"
Expand All @@ -15,7 +15,8 @@ packages = [
[tool.poetry.dependencies]
python = "^3.6"
requests = "^2.22.0"
click = "^7.0"
click = "^8.0.3"


[tool.poetry.dev-dependencies]

Expand Down
19 changes: 11 additions & 8 deletions redash_toolbelt/examples/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,10 @@ def fix_qrds_refs(orig_client, dest_client):
query_text = query["query"]

for origin_id in origin_query_ids:

_origin_id = int(origin_id)
try:
_origin_id = int(origin_id)
except:
continue

dest_id = meta["queries"].get(_origin_id)

Expand Down Expand Up @@ -935,14 +937,15 @@ def import_favorites(orig_client, dest_client):

def fix_csv_queries(orig_client, dest_client):

if "app.redash.io" not in DESTINATION:
if "app.redash.io" not in ORIGIN:
confirm = input(
"It doesn't look like you moved from Hosted Redash. Are you certain you want to run this script? [Type 'yes' to proceed]"
)

if confirm != "yes":
print("Operation aborted")
return
if confirm != "yes":
print("Operation aborted")
return
else:
pass

# Fetch csvurl data sources
data_sources = dest_client.get_data_sources()
Expand Down Expand Up @@ -1285,7 +1288,7 @@ def make_global_meta():
@click.argument(
"command",
)
@click.version_option(version="1.0")
@click.version_option(version="0.1.9")
def main(command):
"""Redash migration tool. Can be used to migrate objects (users, queries, visualizations, dashboards, alerts, and favorites)
from one Redash instance to another.
Expand Down

0 comments on commit ef6e548

Please sign in to comment.