Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blobs get truncated when read #663

Closed
KellerKev opened this issue May 19, 2021 · 1 comment
Closed

blobs get truncated when read #663

KellerKev opened this issue May 19, 2021 · 1 comment

Comments

@KellerKev
Copy link
Contributor

Crhis from the py4web forum brought this up:

Making more test when pydal retrieve the blob data from the db is only getting just a part of the information.

When in print the rows after the select i get a small sample like this:

images = cherry_db(cherry_db.image.node_id == i['node_id']).select(cherry_db.image.node_id, cherry_db.image.png)

for m in images:
print(m['png’])

b'<\xd1\x88\x1c4l\x04\x84\xce 0\x13\xc6\x01\r\xdd\xd0'

@mdipierro
Copy link
Contributor

I tried this and I cannot reproduce:

import random
from pydal import DAL, Field
db =DAL()
db.define_table('x',
                Field('name'),
                Field('data', 'blob'))

random_data = ''.join(chr(random.randint(0,255)) for i in range(1000))
random_data = ''.join(random_data for i in range(100000))
print(repr(random_data[:100]))
id = db.x.insert(name="1", data=random_data)
row = db.x[id]
assert row.data == random_data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants