468,512 Members | 1,633 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

Invalid Literal from MySQLdb Query

I'm attempting to run a simple query through MySQLdb's
cursor.execute(). However, when the request includes a timestamp
field, I'm getting "ValueError: invalid literal for int(): 9-."

Could someone please explain what I'm doing wrong?
The table is served off of MySQL 4.0.20 and contains the following
fields:

doc_id ... int(64)
doc_author ... varchar(255)
doc_created ... timestamp(14)
doc_updated ... timestamp(14)
doc_data ... longtext
Here's an example of the code I'm attempting:

Python 2.3.4 (#1, Sep 24 2004, 12:07:36)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import MySQLdb
db = MySQLdb.connect(host="HOSTNAME", user="USER", passwd="PASSWD", db="DB") cursor = db.cursor()
cursor.execute("select * from documents") Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/home/oneofmanyme/local/lib/python2.3/site-packages/MySQLdb/cursors.py",
line 95, in execute return self._execute(query, args)
File "/home/oneofmanyme/local/lib/python2.3/site-packages/MySQLdb/cursors.py",
line 114, in _execute self.errorhandler(self, exc, value)
File "/home/oneofmanyme/local/lib/python2.3/site-packages/MySQLdb/connections.py",
line 33, in defaulterrorhandler raise errorclass, errorvalue
ValueError: invalid literal for int(): 9-
If I don't include timestamps (such as doc_created) in the query,
things work just fine:
cursor.execute("select doc_id, doc_author from documents") 1L print cursor.fetchone()

(1L, 'oneofmanyme')
Much thanks in advance,
Wesley
Jul 18 '05 #1
0 1288

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Chris Stromberger | last post: by
1 post views Thread by Sheila King | last post: by
1 post views Thread by JZ | last post: by
21 posts views Thread by John Fabiani | last post: by
2 posts views Thread by m0226065 | last post: by
5 posts views Thread by Nicolay A. Vasiliev | last post: by
2 posts views Thread by Nikhil | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.