Reputation: 25
I'm trying to convert a program from python 2 to python 3. The MYSQL database I setup in my program had to be updated. I've ran into a problem very similar to this one, but I don't understand how to change my object from 'connection' to 'Connection' since there's no casting in Python
Here's my code:
import _mysql as mc
db = mc.connect (host = "localhost", user = "root", passwd = "password1234")
cursor = db.cursor()
It looks correct, but for some reason the connect() function is returning a 'connection' object instead of 'Connection'. Any help is appreciated.
Upvotes: 2
Views: 10447
Reputation: 9144
For mysqlclient
import MySQLdb
Do not use _mysql
as it is low level interface and does not include all the methods
Upvotes: 9