The mysql-python tag has no wiki summary.
0
votes
0answers
2 views
MySQLdb - libmysqlclient_r stuck on read()
I am writing a multi-threaded python application that read/write to a MySQL DB (using MySQLDB and libmysqlclient_r - thread safe library).
At some point (not sure why or when), one of the threads ...
0
votes
1answer
26 views
Python mysqldb returns inserted row but mysql returns an emptyset
I use mysqldb to insert a row:
def insertNewLog(self,uid,beginDate,endDate,logs):
qry1 = """INSERT INTO logs (owner,createDate,endDate,log) VALUES (%s,%s,%s,%s); """
cursor = ...
0
votes
1answer
23 views
Internationalization - Python MySQLDb and ISO-8859-7
I have written a python script to parse an HTML page, get some strings and then write to a mysql table. I am using the MySQLDb module for the database connection.
The strings retrieved are encoded ...
0
votes
0answers
19 views
python MySQLdb error
I'm getting this error when running the script at http://pastebin.com/QhsznmYr
*Content-Type: text/html
Traceback (most recent call last):
File "out.py", line 14, in <module>
...
2
votes
1answer
21 views
exception thrown by query through Mysqldb in python. It is being executed at mySQL directly
I am try to calling a function to execute a query:
def run(self,query):
try:
self.cursor = self.conn.cursor ()
self.cursor.execute(query)
except ...
0
votes
1answer
20 views
PyMySQL error/exception on (file) data load to remote MySQL instance
I am using PyMySQL-0.5.0 and facing an obscure'ish error/exception when loading data from a file to a remote MySQL instance. Upon executing a 'load data local infile ...' statement, I am seeing an ...
0
votes
2answers
25 views
Escaping MySQL reserved words with Python dbapi
I am looking for a nice "pythonic" and "SQL-Injection-free" solution for a problem with reserved words in MySQL.
I have the following code:
alter_sql = 'ALTER TABLE %s ADD COLUMN %s TEXT'
...
0
votes
0answers
30 views
Writing MySQL databases in Python using mySQLdb
So I have the following code, and it works:
for count in range(0,1000):
L=[random.randint(0, 127),random.randint(0, 127),random.randint(0, 127)]
random.randint(0, 127)
...
1
vote
1answer
23 views
Problems with execute parameters type in MySQLdb
This code:
c.execute("UPDATE Players SET %s = %d WHERE nick=%s", (parts[1], int(parts[2]), parts[0]))
Is giving me this error:
TypeError: %d format: a number is required, not str
I know execute ...
0
votes
0answers
60 views
Execute .sql file in Python with MySQLdb
I have a .sql file containing a bunch of SQL queries, with each query spanning multiple lines. I want to execute these queries in MySQL via Python using MySQLdb.
sqlite3 has "a nonstandard shortcut" ...
0
votes
0answers
28 views
Lost of Performance when Batch Inserting via Java or Python
When batch inserting either via Java or Python into a MySQL table, is it necessary to clear some configurations of the database connection in order to not lose performance?
(We have the constraint of ...
2
votes
2answers
70 views
Python encoding for swedish charachters
I'm using scrapy to extract data from a web site. I'm saving the data to a mysql database using MysqlDB. The script works for english sites, but when I try it on a swedish site i get:
...
0
votes
2answers
51 views
Does a commit on a Python MySQLdb cursor affect transactions in progress in another cursor?
If I have multiple cursors (each in a different thread, for example) generated from the same DB connection, does a commit on one cursor (e.g. in Python: cursor.execute('COMMIT')) affect transactions ...
0
votes
1answer
43 views
Mysql Update Syntax Error Python
I've been following this previous answer, however I still get a syntax error:
Stack Overflow Answer
cursor.execute ("""
UPDATE tblTableName
SET Year=%s, Month=%s, Day=%s, Hour=%s, ...
0
votes
1answer
57 views
Mysqldb INSERT INTO syntax error in Python
I have an excel file which I am trying to put into mysql. There are 32 fields which I want to extract using the python plugin xlrd and put into mysql. The data is laid out like so:
My methodology ...