开发者

how to model bitarrays in django?

开发者 https://www.devze.com 2023-03-11 06:26 出处:网络
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:

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开发者_Go百科
bits = bitarray.bitarray('11000101010') #real data is 35k bits long

Should i just shove it in a CharField?


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:

"11,C54"

Or ASCII-85, which would take up less space than hex.

0

精彩评论

暂无评论...
验证码 换一张
取 消