-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Issue Summary
I'm trying to upgrade our Redash from version 10.1.0.b50633 to 25.1.0, but when running the migrations (manage db upgrade
) they fail:
Updating hash for query 2578 from 6cfe00c740496094e353c0bc8ec9bf74 to 3e63469e83b2ba100d3479fcd96429a9
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/flask/cli.py", line 357, in decorator
return __ctx.invoke(f, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/flask_migrate/cli.py", line 134, in upgrade
_upgrade(directory, revision, sql, tag, x_arg)
File "/usr/local/lib/python3.10/site-packages/flask_migrate/init.py", line 95, in wrapped
f(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/flask_migrate/init.py", line 280, in upgrade
command.upgrade(config, revision, sql=sql, tag=tag)
File "/usr/local/lib/python3.10/site-packages/alembic/command.py", line 403, in upgrade
script.run_env()
File "/usr/local/lib/python3.10/site-packages/alembic/script/base.py", line 583, in run_env
util.load_python_file(self.dir, "env.py")
File "/usr/local/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 95, in load_python_file
module = load_module_py(module_id, path)
File "/usr/local/lib/python3.10/site-packages/alembic/util/pyfiles.py", line 113, in load_module_py
spec.loader.exec_module(module) # type: ignore
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/app/migrations/env.py", line 93, in
run_migrations_online()
File "/app/migrations/env.py", line 85, in run_migrations_online
context.run_migrations()
File "", line 8, in run_migrations
File "/usr/local/lib/python3.10/site-packages/alembic/runtime/environment.py", line 948, in run_migrations
self.get_context().run_migrations(**kw)
File "/usr/local/lib/python3.10/site-packages/alembic/runtime/migration.py", line 627, in run_migrations
step.migration_fn(**kw)
File "/app/migrations/versions/9e8c841d1a30_fix_hash.py", line 55, in upgrade
new_hash = update_query_hash(record)
File "/app/migrations/versions/9e8c841d1a30_fix_hash.py", line 26, in update_query_hash
query_runner = get_query_runner(record['type'], {}) if record['type'] else BaseQueryRunner({})
File "/app/redash/query_runner/init.py", line 433, in get_query_runner
return query_runner_class(configuration)
File "/app/redash/query_runner/elasticsearch.py", line 95, in init
if self.server_url[-1] == "/":
IndexError: string index out of range
This has happened for several queries even when the underlying query is not using an Elasticsearch data source. In the above example, query 2578 is using a data source of type pg
, but the migration script is still assigning it type elasticsearch
and then failing due to it not having server_url
in it's options.
All the errors I encountered seem to be stemming from the same script - migrations/versions/9e8c841d1a30_fix_hash.py
Steps to Reproduce
- Create a query with data source of type
pg
and run this migration script (migrations/versions/9e8c841d1a30_fix_hash.py
) on it.
I expect the migration script to treat this query as if it has a Postgres data source.
Technical details:
- Redash Version: 10.1.0.b50633 (trying to upgrade to 25.1.0)
- Browser/OS: Ubuntu
- How did you install Redash: Docker