On 1/2/06, Michael Bayer <[EMAIL PROTECTED]> wrote:
I implemented the dbapi.Binary() constructor at the base of types.Binary, and created a new unit test that saves/retrieves a couple of .pyc files. It succeeds for mysql, postgres, and sqlite (all of which needed the Binary constructor)....changeset 775/776.
On Dec 31, 2005, at 7:03 PM, Jonathan Ellis wrote:
from sqlalchemy import *
import urllib# CREATE TABLE foo (
# id serial PRIMARY KEY,
# blob bytea
# ) WITH OIDS;engine = create_engine('postgres', ...)
foo = Table('foo', engine, autoload = True)
class Foo(object): pass
assign_mapper(Foo, foo)f = Foo()
f.blob = urllib.urlopen('http://schlockmercenary.com/comics/schlock20051231.png').read()
print len(f.blob) # 38201
objectstore.commit ()# select octet_length(blob) from foo;
# octet_length
# -------------
# 8
--
Jonathan Ellis
http://spyced.blogspot.com
--
Jonathan Ellis
http://spyced.blogspot.com

