I am trying to build image for redash 4.0 beta version. But I am getting error in logs saying

“ProgrammingError: (psycopg2.ProgrammingError) column users.profile_image_url does not exist
LINE 1: SELECT users.profile_image_url AS users_profile_image_url, u…”

I restore the backup file from redash 3.0. Is there any change in postgres database structure.
As per error it is “user.profile_image_url does not exist”. Earlier there was no such column till redash 3.0 version.
Is there any change in database structure and how to resolve this.


You need to apply migrations.

How to apply migrations?
I have this error:

server_1    | [2018-02-23 07:47:16,892][PID:9][ERROR][redash] Exception on /favicon.ico [GET]
server_1    | Traceback (most recent call last):
server_1    |   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1988, in wsgi_app
server_1    |     response = self.full_dispatch_request()
server_1    |   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1641, in full_dispatch_request
server_1    |     rv = self.handle_user_exception(e)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/flask_restful/__init__.py", line 271, in error_router
server_1    |     return original_handler(e)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1544, in handle_user_exception
server_1    |     reraise(exc_type, exc_value, tb)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1639, in full_dispatch_request
server_1    |     rv = self.dispatch_request()
server_1    |   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1625, in dispatch_request
server_1    |     return self.view_functions[rule.endpoint](**req.view_args)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/flask_login/utils.py", line 226, in decorated_view
server_1    |     elif not current_user.is_authenticated:
server_1    |   File "/usr/local/lib/python2.7/dist-packages/werkzeug/local.py", line 343, in __getattr__
server_1    |     return getattr(self._get_current_object(), name)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/werkzeug/local.py", line 302, in _get_current_object
server_1    |     return self.__local()
server_1    |   File "/usr/local/lib/python2.7/dist-packages/flask_login/utils.py", line 26, in <lambda>
server_1    |     current_user = LocalProxy(lambda: _get_user())
server_1    |   File "/usr/local/lib/python2.7/dist-packages/flask_login/utils.py", line 302, in _get_user
server_1    |     current_app.login_manager._load_user()
server_1    |   File "/usr/local/lib/python2.7/dist-packages/flask_login/login_manager.py", line 317, in _load_user
server_1    |     return self.reload_user()
server_1    |   File "/usr/local/lib/python2.7/dist-packages/flask_login/login_manager.py", line 279, in reload_user
server_1    |     user = self.user_callback(user_id)
server_1    |   File "/app/redash/authentication/__init__.py", line 42, in load_user
server_1    |     return models.User.get_by_id_and_org(user_id, org)
server_1    |   File "/app/redash/models.py", line 240, in get_by_id_and_org
server_1    |     return db.session.query(cls).filter(cls.id == object_id, cls.org == org).one()
server_1    |   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2756, in one
server_1    |     ret = self.one_or_none()
server_1    |   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2726, in one_or_none
server_1    |     ret = list(self)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2797, in __iter__
server_1    |     return self._execute_and_instances(context)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2820, in _execute_and_instances
server_1    |     result = conn.execute(querycontext.statement, self._params)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 945, in execute
server_1    |     return meth(self, multiparams, params)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
server_1    |     return connection._execute_clauseelement(self, multiparams, params)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
server_1    |     compiled_sql, distilled_params
server_1    |   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
server_1    |     context)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1393, in _handle_dbapi_exception
server_1    |     exc_info
server_1    |   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
server_1    |     reraise(type(exception), exception, tb=exc_tb, cause=cause)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
server_1    |     context)
server_1    |   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 469, in do_execute
server_1    |     cursor.execute(statement, parameters)
server_1    | ProgrammingError: (psycopg2.ProgrammingError) column users.profile_image_url does not exist
server_1    | LINE 1: SELECT users.profile_image_url AS users_profile_image_url, u...
server_1    |                ^
server_1    |  [SQL: 'SELECT users.profile_image_url AS users_profile_image_url, users.groups AS users_groups, users.updated_at AS users_updated_at, users.created_at AS users_created_at, users.id AS users_id, users.org_id AS users_org_id, users.name AS users_name, users.email AS users_email, users.password_hash AS users_password_hash, users.api_key AS users_api_key \nFROM users \nWHERE users.id = %(id_1)s AND %(param_1)s = users.org_id'] [parameters: {'id_1': u'1', 'param_1': 1}]

I tried different way. I run the bootstrap.sh file for redash 4.0 (beta) version so that to create new new database with new table format as per 4.0. And my container is Up and redash application is also running properly.
(And changes are really awesome :heart_eyes: )

But the problem is when I try to restore the old backup in this new database it is giving error(that will give for sure as both table have some different columns like extra column ‘profile_image_url’ in user table).

So how to restore old redash backup from redash 3.0 or of older version to new redash 4.0 (beta) database.

You could try pgdiff to create a sql script that upgrades your v3 database to v4 schema. Then you backup old and restore to new. This may not work if new v4 constraints get in the way (null values in new not null columns.

We are experimenting the same problem. Were you able to migrate data from v3 to v4?

what you need to do first is to upgrade your db, after that migrate it

./manage.py db upgrade
./manage.py db migrate

how do i apply migrations ,i ran the redash on ecs