Pysqlite storing file as blob example

7stud bbxx789_05ss at
Tue Jul 31 09:13:53 CEST 2007

On Jul 30, 6:25 pm, rustyhow... at wrote:
> I'm trying to store binary data in a sqlite database and call into the
> db using pysqlite 3.
> What I've got so far is this:
> import sqlite
> con = sqlite.connect(DB_PATH)
> cur = con.cursor()
> query = """create table t1(
>             data    BLOB );"""
> cur.execute(query)
> con.commit()
> b = buffer('/path/to/binary/file')

buffer() ?

>From the docs:

There are several built-in functions that are no longer essential to
learn, know or use in modern Python programming. They have been kept
here to maintain backwards compatibility with programs written for
older versions of Python.
buffer(object[, offset[, size]])

More information about the Python-list mailing list