【发布时间】:2016-07-12 08:27:09
【问题描述】:
我在 PyMySQL 中使用 Peewee,但在尝试使用 playhouse 模块中的 CompressedField 时,我遇到了 64k blob 大小的问题...
以下代码为我提供了第二次测试的截断数据
from peewee import *
from playhouse.db_url import connect
from playhouse.fields import CompressedField
db = connect("mysql://me:pass@IP/test_db")
class Compress(Model):
name = CharField()
cmprssd_data = CompressedField()
class Meta:
database = db
db.connect()
db.create_tables([Compress], safe=True)
short_str = "".zfill(200)
di_test1 = {"name": "first", "cmprssd_data": short_str }
test1 = Compress(**di_test1)
test1.save()
long_str = "".zfill(200000000)
di_test2 = {"name": "second", "cmprssd_data": long_str }
test2 = Compress(**di_test2)
test2.save()
我尝试在 MySQL 和 pymysql 中将 'max_allowed_packet' 更新为 1073741824 但这并没有改变任何东西。
顺便说一句,我认为这是同样的问题,使用 long_str 和 PickledField 会给我一个损坏的管道错误。
有没有办法告诉 peewee 与 longblob 合作? (或者问题是否来自其他地方?)
我还找到了thread on the broken pipe problem with pymysql,但我不知道如何告诉 Peewee 模型在该特定字段上执行块内容...
【问题讨论】:
标签: python mysql peewee pymysql