On Nov 28, 2007, at 12:03 PM, imgrey wrote:

>
>> the 0.4 pattern for using scoped_session is:
>>
>> session = scoped_session(sessionmaker(transactional=(True|False),
>> autoflush=(True|False)))
>
> defined globaly:
> session = scoped_session(sessionmaker(transactional=True,
> autoflush=False))
>
> result:
>

it seems like youre doing something else in there that youre not  
supposed to (like accessing SessionTransaction perhaps ?  dont use the  
old 0.3 patterns anymore).

heres a working example:

from sqlalchemy import *
from sqlalchemy.orm import *

session = scoped_session(sessionmaker(transactional=True,  
autoflush=False))

engine = create_engine('sqlite://')

session.configure(bind=engine)

meta = MetaData()
foo = Table('foo', meta, Column('id', Integer, primary_key=True),  
Column('name', String(30)))
foo.create(engine)

class Foo(object):
     pass

mapper(Foo, foo)

f = Foo()
f.name = 'hi'
session.save(f)
session.commit()

session.clear()

f2 = session.query(Foo).filter(Foo.name=='hi').one()
assert f2.id == f.id





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to