question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

superset Database on mysql Unexpected error name '_mysql' is not defined

See original GitHub issue

A clear and concise description of what the bug is.

i install superset on MacOS 10.15.5 when i want to add the DB source of mysql, i click the button of [Test Connection],they out the error message

ERROR: Unexpected error occurred, please check your logs for details

then i see the console out the error info

Unexpected error name '_mysql' is not defined
ERROR:superset.views.core:Unexpected error name '_mysql' is not defined
INFO:werkzeug:127.0.0.1 - - [22/Jul/2020 23:10:09] "POST /superset/testconn HTTP/1.1" 400 -

Expected results

i don’t know what to do, please tell me what to do.

Actual results

Screenshots

How to reproduce the bug

  1. when i running the cmd of start superset and visit the web http://localhost:8088/,
  2. use the menu – > Sources --> Databases, input something then Click on ‘Test Connection’
  3. Scroll down to ‘…’
  4. See error
Unexpected error name '_mysql' is not defined
ERROR:superset.views.core:Unexpected error name '_mysql' is not defined
INFO:werkzeug:127.0.0.1 - - [22/Jul/2020 23:10:09] "POST /superset/testconn HTTP/1.1" 400 -

Environment

(please complete the following information):

  • superset version: superset 0.36.0
  • python version: Python 3.7.7
  • node.js version: node v12.10.0
  • npm version: npm v6.11.3
  • mysql version:mysql 8.0.19
  • mysqlclient version:mysqlclient 2.0.1
  • mysql-connector-python version:mysql-connector-python 8.0.21

Checklist

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven’t found one similar.

Additional context

Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
liuyuchuancommented, Aug 18, 2020

OMG! The problem is solved after i installed the pymysql driver like this: pip install pymysql then i use the SQLAlchemy URI like this: mysql+pymysql://root:Root1234@127.0.0.1:3306/superset

and i use the uri like this is work too. mysql+mysqlconnector://root:Root1234@127.0.0.1:3306/superset

image

i want to know why i can’t use the SQLAlchemy URI like this:

mysql+mysqldb://root:Root1234@127.0.0.1:3306/superset
or
mysql://root:Root1234@127.0.0.1:3306/superset
1reaction
fly904021125commented, Mar 28, 2022

OMG! The problem is solved after i installed the pymysql driver like this: pip install pymysql then i use the SQLAlchemy URI like this: mysql+pymysql://root:Root1234@127.0.0.1:3306/superset

and i use the uri like this is work too. mysql+mysqlconnector://root:Root1234@127.0.0.1:3306/superset

image

i want to know why i can’t use the SQLAlchemy URI like this:

mysql+mysqldb://root:Root1234@127.0.0.1:3306/superset
or
mysql://root:Root1234@127.0.0.1:3306/superset

it also works for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

name '_mysql' is not defined after setting change to mysql ...
So this NameError: name '_mysql' is not defined is the problem. I installed mysqlclient before, changed settings.py , made db in mysql, ...
Read more >
superset Database on mysql Unexpected error name '_mysql ...
[GitHub] [incubator-superset] liuyuchuan opened a new issue #10396: superset Database on mysql Unexpected error name '_mysql' is not defined.
Read more >
Issue Code Reference - Apache Superset
The database returned an unexpected error. ... Your query failed because of an error that occurred on the database. This may be due...
Read more >
nameerror: name _mysql is not defined ( Best Solution )
nameerror : name _mysql is not defined error occurs while connecting python end application with MySQL DB due to incompatibility or client/ connector ......
Read more >
I am not able to create a table inside my database... - 237893
In "Superset" view, from "Sources" tab, I clicked on "Tables". I then clicked on the "+" sign beside "Add Filter", I chose my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found