65K length limitation in MySQLdb?

T

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top