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.

the order of importing mysql database driver is wrong

See original GitHub issue
try:
    import pymysql as mysql
except ImportError:
    try:
        import MySQLdb as mysql  # prefer the C module.
        mysql_passwd = True
    except ImportError:
        mysql = None

As your comment, we should prefer the C module as default because it has better performance for production but the order of importing mysql database driver is wrong.

It should be great If we can choose our database driver like sqlalchemy.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
coleifercommented, Jul 5, 2018

So mysql-python (MySQLdb) does not support Python 3, which is why it is no longer preferred. The comment needs to be updated.

If you would like to explicitly use a particular driver, it is quite easy:

import MySQLdb

class MySQLDatabaseCustom(MySQLDatabase):
    def _connect(self):
        return MySQLdb.connect(db=self.database, **self.connect_params)
0reactions
coleifercommented, Jul 6, 2018

No disturbance – I recognize it’s a somewhat opinionated stance and the comment was incorrect, which made it worse. Hope you’re able to get things working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

8.4 Connector/ODBC Errors and Resolutions (FAQ)
This error occurs only with MySQL tables using the TEXT or VARCHAR data types. You can fix this error by upgrading your Connector/ODBC...
Read more >
ImportError: No module named mysql.connector using Python2
I have two files. The first one has the connection and the getting of data. I import mysql.connector ...
Read more >
Database Import Wizard error in MySQL DB Connector
I'm trying to import data via 'Database Import Wizard' (MySQL DB). But while trying to create the profile,I encounter this error message: "Unable...
Read more >
How to Fix java.lang.ClassNotFoundException: com.mysql ...
Cause : In order to connect to MySQL database, you need JDBC driver for MySQL. A class that implements java.sql.Driver interface for MySQL....
Read more >
My WebMethods startup problem with mysql database driver
The reason might be that the database tables are not completely created. Running the database component configurator we get the following error ...
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