[sqlalchemy] How to load properties of table manually?

2010-06-06 Thread Victor Lin
Hi, I use a cache on some pages of my TurboGears2 application, and I encounter a problem. There is a query in those page method, for example: @beaker_cache(expire=30, type='memory', query_args=True) @expose() def foo(): data = DBSession.query(Bar).all() return dict(data=data) Here come

Re: [sqlalchemy] 2 transactions for one

2010-06-06 Thread Michael Bayer
On Jun 6, 2010, at 5:18 PM, marco vaccari wrote: > This script lock in the update statement following select for update: > > eng=sqlalchemy.create_engine('postgres://x.loc/db') > metadata=sqlalchemy.MetaData() > metadata.bind=eng > tab1 = Table('tab1', metadata, autoload=True) > > a_rec = > tab

[sqlalchemy] 2 transactions for one

2010-06-06 Thread marco vaccari
This script lock in the update statement following select for update: eng=sqlalchemy.create_engine('postgres://x.loc/db') metadata=sqlalchemy.MetaData() metadata.bind=eng tab1 = Table('tab1', metadata, autoload=True) a_rec = tab1.select( for_update=True ).where(the_condition).execute().fetchone()

[sqlalchemy] Re: Questions about "session"

2010-06-06 Thread Az
Hi Conor, Basically I sat down and made some decisions and changes. I've created an actual copy of the Student class as in I've now got two classes, Student and StudentUnmapped. The Unmapped one has the same attributes as the mapped one, except for being... well, unmapped. Now I can a) use deepco

[sqlalchemy] Re: relation to table to original table

2010-06-06 Thread cd34
as I stumble across join_depth :) Had I just waited another five minutes to post. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to

[sqlalchemy] relation to table to original table

2010-06-06 Thread cd34
I've got a schema that I was having problems with last night. I got it working, but, it seems somewhat dangerous unless I force lazy loading: class User(Base): __tablename__ = 'xxx_users' fb_uid = Column(mysql.MSBigInteger(20, unsigned=True), primary_key=True) friends = relation('U