Installed the latest version of re:dash using the bash script, logged in as admin, created a new mongodb data source and called it “staging_DB”, then I created another data source and by mistake called it also “staging_DB”, I got a “saving failed” msg so I realized my mistake and corrected it to “production_DB”, got another “saving failed”, refreshed the page and got an internal error, this is the relevant trace from the log file:

[2016-08-09 13:36:57,329][PID:30985][ERROR][redash] Exception on /api/data_sources [GET]
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/flask/app.py”, line 1475, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/local/lib/python2.7/dist-packages/flask/app.py”, line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File “/usr/local/lib/python2.7/dist-packages/flask_restful/init.py”, line 477, in wrapper
resp = resource(args, *kwargs)
File “/usr/local/lib/python2.7/dist-packages/flask_login.py”, line 792, in decorated_view
return func(args, *kwargs)
File “/usr/local/lib/python2.7/dist-packages/flask/views.py”, line 84, in view
return self.dispatch_request(args, *kwargs)
File “/opt/redash/current/redash/handlers/base.py”, line 25, in dispatch_request
return super(BaseResource, self).dispatch_request(args, *kwargs)
File “/usr/local/lib/python2.7/dist-packages/flask_restful/init.py”, line 587, in dispatch_request
resp = meth(args, *kwargs)
File “/opt/redash/current/redash/permissions.py”, line 41, in decorated
return fn(args, *kwargs)
File “/opt/redash/current/redash/handlers/data_sources.py”, line 66, in get
d = ds.to_dict()
File “/opt/redash/current/redash/models.py”, line 378, in to_dict
‘syntax’: self.query_runner.syntax,
File “/opt/redash/current/redash/models.py”, line 454, in query_runner
return get_query_runner(self.type, self.options)
File “/opt/redash/current/redash/query_runner/init.py”, line 148, in get_query_runner
return query_runner_class(configuration)
File “/opt/redash/current/redash/query_runner/mongodb.py”, line 101, in init
self.db_name = self.configuration[“dbName”]
File “/opt/redash/current/redash/utils/configuration.py”, line 73, in getitem
raise KeyError(item)
KeyError: ‘dbName’

Can you suggest a way of quick fixing it? re-installing on same machine didn’t help.

The MongoDB query runner expects a Database Name value but doesn’t mark it as required. You probably didn’t set it when creating the data source, and this causes the error.

I guess the easiest way will be to delete the data sources you created with the CLI:

  1. Change dir to /opt/redash/current.
  2. Run: bin/run ./manage.py ds delete staging_DB and run: bin/run ./manage.py ds delete production_DB.

Then recreate the MongoDB data sources with specifying both the connection string and the db name.

(Changed the db name to be mandatory to avoid future instances of this issue: https://github.com/getredash/redash/pull/1234)

manage.py returns error “role “root” does not exist”.

Prefix the commands with sudo -u redash, i.e. sudo -u redash bin/run ./manage.py ds delete....

“sudo -u redash ./manage.py ds delete staging_DB” gives the following error:

[2016-08-14 07:49:35,370][PID:29947][ERROR][peewee] SELECT “t1”.“id”, “t1”.“updated_at”, “t1”.“created_at”, “t1”.“name”, “t1”.“slug”, “t1”.“settings” FROM “organizations” AS t1 WHERE (“t1”.“slug” = %s) LIMIT 1 [u’default’]
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/playhouse/postgres_ext.py”, line 360, in execute_sql
cursor.execute(sql, params or ())
ProgrammingError: relation “organizations” does not exist
LINE 1: …", “t1”.“name”, “t1”.“slug”, “t1”.“settings” FROM "organizat…

Traceback (most recent call last):
File “./manage.py”, line 59, in
manager.run()
File “/usr/local/lib/python2.7/dist-packages/flask_script/init.py”, line 405, in run
result = self.handle(sys.argv[0], sys.argv[1:])
File “/usr/local/lib/python2.7/dist-packages/flask_script/init.py”, line 384, in handle
return handle(app, *positional_args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/flask_script/commands.py”, line 145, in handle
return self.run(*args, **kwargs)
File “/opt/redash/redash.0.11.1.b2095/redash/cli/data_sources.py”, line 104, in delete
org = models.Organization.get_by_slug(organization)
File “/opt/redash/redash.0.11.1.b2095/redash/models.py”, line 193, in get_by_slug
return cls.get(cls.slug == slug)
File “/usr/local/lib/python2.7/dist-packages/peewee.py”, line 4012, in get
return sq.get()
File “/usr/local/lib/python2.7/dist-packages/peewee.py”, line 2641, in get
return clone.execute().next()
File “/usr/local/lib/python2.7/dist-packages/peewee.py”, line 2682, in execute
self._qr = ResultWrapper(model_class, self._execute(), query_meta)
File “/opt/redash/redash.0.11.1.b2095/redash/metrics/database.py”, line 50, in metered_execute
result = real_execute(self, *args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/peewee.py”, line 2371, in _execute
return self.database.execute_sql(sql, params, self.require_commit)
File “/opt/redash/redash.0.11.1.b2095/redash/metrics/database.py”, line 22, in execute_sql
result = super(MeteredPostgresqlExtDatabase, self).execute_sql(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/playhouse/postgres_ext.py”, line 369, in execute_sql
self.commit()
File “/usr/local/lib/python2.7/dist-packages/peewee.py”, line 2922, in exit
reraise(new_type, new_type(*exc_value.args), traceback)
File “/usr/local/lib/python2.7/dist-packages/playhouse/postgres_ext.py”, line 360, in execute_sql
cursor.execute(sql, params or ())
peewee.ProgrammingError: relation “organizations” does not exist
LINE 1: …", “t1”.“name”, “t1”.“slug”, “t1”.“settings” FROM "organizat…

It’s as if a table is missing. Can you run sudo -u redash psql -c "\d" and share the output?

Did the first time you ran the bootstrap script it finished without errors?

Experiencing the same issue.
How did you resolve it?

Using Redash 3.0.0+b3134
Output to sudo -u redash psql -c “\d” is :

Schema | Name | Type | Owner
--------±---------------------------------±---------±-------
public | access_permissions | table | redash
public | access_permissions_id_seq | sequence | redash
public | alembic_version | table | redash
public | alert_subscriptions | table | redash
public | alert_subscriptions_id_seq | sequence | redash
public | alerts | table | redash
public | alerts_id_seq | sequence | redash
public | api_keys | table | redash
public | api_keys_id_seq | sequence | redash
public | changes | table | redash
public | changes_id_seq | sequence | redash
public | dashboards | table | redash
public | dashboards_id_seq | sequence | redash
public | data_source_groups | table | redash
public | data_source_groups_id_seq | sequence | redash
public | data_sources | table | redash
public | data_sources_id_seq | sequence | redash
public | events | table | redash
public | events_id_seq | sequence | redash
public | groups | table | redash
public | groups_id_seq | sequence | redash
public | notification_destinations | table | redash
public | notification_destinations_id_seq | sequence | redash
public | organizations | table | redash
public | organizations_id_seq | sequence | redash
public | queries | table | redash
public | queries_id_seq | sequence | redash
public | query_results | table | redash
public | query_results_id_seq | sequence | redash
public | query_snippets | table | redash
public | query_snippets_id_seq | sequence | redash
public | users | table | redash
public | users_id_seq | sequence | redash
public | visualizations | table | redash
public | visualizations_id_seq | sequence | redash
public | widgets | table | redash
public | widgets_id_seq | sequence | redash