Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql_info() equivalent in Python

Tags:

python

mysql

I'm looking for a mysql_info() equivalent in Python. My script executes a LOAD DATA LOCAL INFILE statement and I would like to have information like this : Records: 3 Duplicates: 0 Warnings: 0.

I looked inside the Connector/Python API Reference but I didn't found anything.

Is there a way to get that information ?

like image 676
Julien D. Avatar asked Sep 21 '26 18:09

Julien D.


1 Answers

Connector/Python does not have a method directly showing the required info, but you can in a way(not a good way) get the required info.

conn = mysql.connector.connect(...)
result =  conn.cmd_query("LOAD DATA LOCAL INFILE query")
print (result['info_msg'])
like image 57
Peeyush Avatar answered Sep 23 '26 07:09

Peeyush



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!