Category: MySql

eclipse pydev error – not finding

I just compiled and installed mysqldb for python 2.7 on my mac os 10.7. import MySQLdb as mysql def main(): conn = mysql.connect( charset=”utf8″, use_unicode=True, host=”localhost”,user=”root”, passwd=””,db=”” ) if __name__ == ‘__main__'(): main() When executing it I get the following error message Traceback (most recent call last): File “/path/to/project/Python/src/cvdv/”, line 4, in import MySQLdb as

Continue Reading →

MySQLDb inserting data into a MySQL table with variables

Of the many ways to inset values into a MySQL database, we could use the below also: insert_query = “INSERT INTO %s(symbol, date,open,high,low,close,volume) VALUES( %s,%s, %s , %s , %s , %s, %s )” insert_cursor.execute(insert_query %(symbol_Nasdaq, symbol_Nasdaq, row_Nasdaq[0], row_Nasdaq[1], row_Nasdaq[2], row_Nasdaq[3], row_Nasdaq[4], volume_fin)) The above query will most likely give you an error stating the

Continue Reading →