How can I upgrade the redash from 4 to 5 where redash is in kubernetes and database is in aws rds postgresql?

How can I upgrade the redash from 4 to 5 where the database is in aws postgresql rds instance and redash is in kubernetes? When I treid to upgrade with empty database it is working fine. But not able to refresh the data as schema has changed. But when I tried to upgrade it with the database pod is stuck at init container only.

Did you run migrations after doing the upgrade?

Hi @arikfr, I found the issue is not with the kubernetes. I have deployed the application using docker-compose file and tried to do upgrade by changing the version. Then I found the error Can’t locate revision identified by ‘e5c7a4e2df4d’ .
I tried in two different ways:-

  1. I tried to updated the alembic_version in postgresql db with the last updated version under /app/migrations/revisions directory. But when I ran the upgrade, I am getting errors like particular table or column didn’t exist. So, I tried to manually update the table but didn’t work all the time as I am actually deleting some data and failed to find which kind of data should I keep in the added columns.

  2. In the second method, instead of changing the alembic_version in postgresql db, I have copied the revision file from https://github.com/getredash/redash/blob/master/migrations/versions/e5c7a4e2df4d_remove_query_tracker_keys.py into the /app/migrations/revisions directory and tried to run the upgrade. I am getting this below error. Could you please help me how can I resolve this?

/usr/local/lib/python2.7/dist-packages/alembic/util/messaging.py:69: UserWarning: Revision 98af61feea92 referenced from 98af61feea92 -> e5c7a4e2df4d (head), remove_query_tracker_keys
Revision ID: e5c7a4e2df4d
Revises: 98af61feea92
Create Date: 2019-02-27 11:30:15.375318 is not present
warnings.warn(msg)
Traceback (most recent call last):
File “/app/manage.py”, line 9, in
manager()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/flask/cli.py”, line 345, in main
return AppGroup.main(self, *args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/flask/cli.py”, line 229, in decorator
return __ctx.invoke(f, *args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/flask_migrate/cli.py”, line 132, in upgrade
_upgrade(directory, revision, sql, tag, x_arg)
File “/usr/local/lib/python2.7/dist-packages/flask_migrate/init.py”, line 239, in upgrade
command.upgrade(config, revision, sql=sql, tag=tag)
File “/usr/local/lib/python2.7/dist-packages/alembic/command.py”, line 254, in upgrade
script.run_env()
File “/usr/local/lib/python2.7/dist-packages/alembic/script/base.py”, line 427, in run_env
util.load_python_file(self.dir, ‘env.py’)
File “/usr/local/lib/python2.7/dist-packages/alembic/util/pyfiles.py”, line 81, in load_python_file
module = load_module_py(module_id, path)
File “/usr/local/lib/python2.7/dist-packages/alembic/util/compat.py”, line 135, in load_module_py
mod = imp.load_source(module_id, path, fp)
File “migrations/env.py”, line 87, in
run_migrations_online()
File “migrations/env.py”, line 80, in run_migrations_online
context.run_migrations()
File “”, line 8, in run_migrations
File “/usr/local/lib/python2.7/dist-packages/alembic/runtime/environment.py”, line 836, in run_migrations
self.get_context().run_migrations(**kw)
File “/usr/local/lib/python2.7/dist-packages/alembic/runtime/migration.py”, line 321, in run_migrations
for step in self._migrations_fn(heads, self):
File “/usr/local/lib/python2.7/dist-packages/alembic/command.py”, line 243, in upgrade
return script._upgrade_revs(revision, rev)
File “/usr/local/lib/python2.7/dist-packages/alembic/script/base.py”, line 336, in _upgrade_revs
revs = list(revs)
File “/usr/local/lib/python2.7/dist-packages/alembic/script/revision.py”, line 645, in iterate_revisions
requested_lowers = self.get_revisions(lower)
File “/usr/local/lib/python2.7/dist-packages/alembic/script/revision.py”, line 299, in get_revisions
return sum([self.get_revisions(id_elem) for id_elem in id
], ())
File “/usr/local/lib/python2.7/dist-packages/alembic/script/revision.py”, line 301, in get_revisions
resolved_id, branch_label = self.resolve_revision_number(id)
File “/usr/local/lib/python2.7/dist-packages/alembic/script/revision.py”, line 437, in _resolve_revision_number
self._revision_map
File “/usr/local/lib/python2.7/dist-packages/alembic/util/langhelpers.py”, line 239, in get
obj.dict[self.name] = result = self.fget(obj)
File “/usr/local/lib/python2.7/dist-packages/alembic/script/revision.py”, line 152, in revision_map
down_revision = map
[downrev]
KeyError: ‘98af61feea92’