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 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/ 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
Traceback (most recent call last):
File “/app/”, line 9, in
File “/usr/local/lib/python2.7/dist-packages/click/”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/flask/”, line 345, in main
return AppGroup.main(self, *args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/”, line 696, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/”, line 534, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/flask/”, line 229, in decorator
return __ctx.invoke(f, *args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/”, line 534, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/flask_migrate/”, line 132, in upgrade
_upgrade(directory, revision, sql, tag, x_arg)
File “/usr/local/lib/python2.7/dist-packages/flask_migrate/”, line 239, in upgrade
command.upgrade(config, revision, sql=sql, tag=tag)
File “/usr/local/lib/python2.7/dist-packages/alembic/”, line 254, in upgrade
File “/usr/local/lib/python2.7/dist-packages/alembic/script/”, line 427, in run_env
util.load_python_file(self.dir, ‘’)
File “/usr/local/lib/python2.7/dist-packages/alembic/util/”, line 81, in load_python_file
module = load_module_py(module_id, path)
File “/usr/local/lib/python2.7/dist-packages/alembic/util/”, line 135, in load_module_py
mod = imp.load_source(module_id, path, fp)
File “migrations/”, line 87, in
File “migrations/”, line 80, in run_migrations_online
File “”, line 8, in run_migrations
File “/usr/local/lib/python2.7/dist-packages/alembic/runtime/”, line 836, in run_migrations
File “/usr/local/lib/python2.7/dist-packages/alembic/runtime/”, line 321, in run_migrations
for step in self._migrations_fn(heads, self):
File “/usr/local/lib/python2.7/dist-packages/alembic/”, line 243, in upgrade
return script._upgrade_revs(revision, rev)
File “/usr/local/lib/python2.7/dist-packages/alembic/script/”, line 336, in _upgrade_revs
revs = list(revs)
File “/usr/local/lib/python2.7/dist-packages/alembic/script/”, line 645, in iterate_revisions
requested_lowers = self.get_revisions(lower)
File “/usr/local/lib/python2.7/dist-packages/alembic/script/”, 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/”, line 301, in get_revisions
resolved_id, branch_label = self.resolve_revision_number(id)
File “/usr/local/lib/python2.7/dist-packages/alembic/script/”, line 437, in _resolve_revision_number
File “/usr/local/lib/python2.7/dist-packages/alembic/util/”, line 239, in get
obj.dict[] = result = self.fget(obj)
File “/usr/local/lib/python2.7/dist-packages/alembic/script/”, line 152, in revision_map
down_revision = map
KeyError: ‘98af61feea92’