Error when adding MongoDB data source

Issue Summary

Error when adding MongoDB data source

Technical details:

When I added the MongoDB data source, the error "name‘db_connection’ is not defined "appeared. I found db_connection in the source code,

def test_connection(self):
        db = self._get_db()
        if not db.command("connectionStatus")["ok"]:
            raise Exception("MongoDB connection error")

        return db_connection[self.db_name]

I modified db_connection[self.db_name]—>db.db_connection[self.db_name]. Then it works.

  • Redash Version:redash v8
  • Browser/OS: Mac
  • How did you install Redash: python3.8.2+nodejs

A few thoughts:

You’re running Redash V8 with Python 3.8.2 which isn’t supported. V8 runs on Python 2.7.

Next, the final line of test_connection() did not come from our repo. Our test_connection method in V8 can be found here:

So it looks like someone else added that final line, it broke things, you changed the line and fixed it. Where did you get your Redash source files?

I used redash-master downloaded on April 3. I just glanced at github and I found that you fixed this bug three days ago。

THANK YOU~~:slight_smile: :slight_smile: