468,458 Members | 1,764 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

65K length limitation in MySQLdb?

TT
I'm trying to using the following code insert a long string into a
MySQL table, the data type is of that column is TEXT. When the length
of the content is longer than 65K, it get truncated in the database.
Any idea about this? Thanks

import MySQLdb
import MySQLdb.cursors

class MyDb:
def __init__(self):
self.conn = None
self.cursor = None

def connect(self):
self.conn = MySQLdb.Connect(
host='localhost', user='user',
passwd='password', db='testdb',compress=1,
cursorclass=MySQLdb.cursors.DictCursor)
self.cursor = self.conn.cursor()

def insert(self, id, content):
try:
self.cursor.execute("INSERT INTO `my_table`(`id`,
`content`) VALUES (%s, %s);", (id, content));
except:
print "Failed to insert new record"
pass
Jun 27 '08 #1
1 1584
On 2008-06-10, TT <vt****@gmail.comwrote:
I'm trying to using the following code insert a long string into a
MySQL table, the data type is of that column is TEXT. When the length
of the content is longer than 65K, it get truncated in the database.
Any idea about this? Thanks
It's limitation on your sql engine, use longtext.

http://dev.mysql.com/doc/refman/5.0/...uirements.html

--
Jarkko Torppa
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Dave Harrison | last post: by
1 post views Thread by Peter Nikolaidis | last post: by
3 posts views Thread by Seong-Kook Shin | last post: by
14 posts views Thread by Luiz Antonio Gomes Pican?o | last post: by
1 post views Thread by Steve | last post: by
1 post views Thread by Yi Xing | last post: by
reply views Thread by Steve Holden | last post: by
reply views Thread by Edwin.Madari | last post: by
reply views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.