Re: Pysqlite storing file as blob example



On Jul 30, 6:25 pm, rustyhow...@xxxxxxxxx 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]])
----

.



Relevant Pages

  • RE: pysqlite problem
    ... | con = sqlite.connect ... | cur = con.cursor ... Because sqlite ... anti-virus service working around the clock, around the globe, visit: ...
    (comp.lang.python)
  • Re: pysqlite problem
    ... from pysqlite2 import dbapi2 as sqlite ... con = sqlite.connect ... cur = con.cursor ... cur.execute("select * from tbl1") ...
    (comp.lang.python)