By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,035 Members | 1,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,035 IT Pros & Developers. It's quick & easy.

65K length limitation in MySQLdb?

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.