Potentially. I woukd file a problem in github and use raw sql as workaround for now.
Adding the py4web community to this.... On Tue, May 18, 2021, 20:23 Chris <[email protected]> wrote: > I could do it with pydal but with sqlite3 library worked perfect. Is maybe > a pydal bug ? > > > Cheers. > > -- > Sent from Canary <https://canarymail.io> > > On martes, may. 18, 2021 at 1:59 p. m., Chris <[email protected]> > wrote: > Data is already in binary in db. > > > > 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' > > > Cheers > > -- > Sent from Canary <https://canarymail.io> > > On martes, may. 18, 2021 at 1:51 p. m., Kevin Keller <[email protected]> > wrote: > I think you have to convert the image file to binary data before saving > tad blob etc..? > > > https://pynative.com/python-mysql-blob-insert-retrieve-file-image-as-a-blob-in-mysql/ > > > > On Tue, May 18, 2021, 19:04 Chris <[email protected]> wrote: > >> Hi, i’m trying to read images from a existing sqlite db. For some reason >> when i save the images to disk, they are corrupted. >> this is my code: >> >> cherry_db = DAL('sqlite://{}'.format(form.vars.cherry_file), >> folder=upload_folder, migrate=False) >> >> cherry_db.define_table('image', >> Field('node_id', 'integer', requires=IS_NOT_EMPTY()), >> Field('png', 'blob') >> ) >> >> 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: >> name = str(uuid.uuid4()) >> print('image {}'.format(name)) >> print(m['png']) >> im = open('{}'.format(session.project_folder+'/'+name+'.png'), 'wb') >> im.write(m['png']) >> im.close() >> >> >> Any help is appreciated >> >> Cheers. >> Chris. >> >> -- >> Sent from Canary <https://canarymail.io> >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/web2py/30b99d7b-941c-4387-80cd-9f521399af82%40Canary >> <https://groups.google.com/d/msgid/web2py/30b99d7b-941c-4387-80cd-9f521399af82%40Canary?utm_medium=email&utm_source=footer> >> . >> > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/CADHCKLTUpqY99R9qfcgvJ7Thi9263LSbtD2XJx6NjEym-kLQgQ%40mail.gmail.com > <https://groups.google.com/d/msgid/web2py/CADHCKLTUpqY99R9qfcgvJ7Thi9263LSbtD2XJx6NjEym-kLQgQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/3f7419fc-a9e0-4ca6-b031-dd2839be2ca4%40Canary > <https://groups.google.com/d/msgid/web2py/3f7419fc-a9e0-4ca6-b031-dd2839be2ca4%40Canary?utm_medium=email&utm_source=footer> > . > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CADHCKLRXA%2BTxUVjdtumZ19b%3DwBUXuTqkBWLXK-rd8TUpteuj%2BA%40mail.gmail.com.

