如何在 django 中对位数组进行建模?
在 django 模型(mysql 后端)中存储大型位数组的最佳方法是什么?
例如,我如何存储这个对象:
import bitarray
bits = bitarray.bitarray('11000101010') #real data is 35k bits long
我应该将它推入 CharField 中吗?
What would be the best way to store a large bitarray within a django model (mysql backend)?
for example, how could i store this object:
import bitarray
bits = bitarray.bitarray('11000101010') #real data is 35k bits long
Should i just shove it in a CharField?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MySQL 有一个值得考虑的 BLOB 字段类型。
或者您可以将其转换为十六进制字符串,以长度为前缀,这将占用不到 9KB:
或 ASCII-85,这将占用比十六进制更少的空间。
MySQL has a BLOB field type that's worth considering.
Or you could converting it to a hex string, prefixed with the length, which would take up less than 9KB:
Or ASCII-85, which would take up less space than hex.