Pysqlite storing file as blob example

7stud bbxx789_05ss at yahoo.com
Tue Jul 31 03:13:53 EDT 2007


On Jul 30, 6:25 pm, rustyhow... at gmail.com 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(
>             ID INTEGER PRIMARY KEY,
>             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