How to insert pandas dataframe via mysqldb into database?

Update: There is now a to_sql method, which is the preferred way to do this, rather than write_frame: df.to_sql(con=con, name=”table_name_for_df”, if_exists=”replace”, flavor=”mysql”) Also note: the syntax may change in pandas 0.14… You can set up the connection with MySQLdb: from pandas.io import sql import MySQLdb con = MySQLdb.connect() # may need to add some other … Read more

“Cannot open include file: ‘config-win.h’: No such file or directory” while installing mysql-python

All I had to do was go over to oracle, and download the MySQL Connector C 6.0.2 (newer doesn’t work!) and do the typical install. https://downloads.mysql.com/archives/c-c/ Be sure to include all optional extras (Extra Binaries) via the custom install, without these it did not work for the win64.msi Once that was done, I went into … Read more

When to close cursors using MySQLdb

Instead of asking what is standard practice, since that’s often unclear and subjective, you might try looking to the module itself for guidance. In general, using the with keyword as another user suggested is a great idea, but in this specific circumstance it may not give you quite the functionality you expect. As of version … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)