[sqlalchemy] Re: Subqueries as secondary tables

2008-12-27 Thread Michael Bayer
you probably dont want to bother with "secondary" since it doesnt get you anything here and you should likely pare down the size of your join condition to something more minimal.you might want to also make life easier and make the relation to a non_primary mapper for Apples which maps

[sqlalchemy] Subqueries as secondary tables

2008-12-27 Thread Alan Shields
(wow, way to go tab key! Sorry, folks) I'm having a bit of trouble and I think it may be a deficiency in my understanding of SqlAlchemy. Let's say I have: Table(Apples) Table(Crates) apples_by_crate = \ select([ crate_table.c.id.label("crate_id"), apple_table.c.id.label("a

[sqlalchemy] Subqueries as tables

2008-12-27 Thread Alan Shields
I'm having a bit of trouble and I think it may be a deficiency in my understanding of SqlAlchemy. Let's say I have: Table(Apples) Table(Crates) mapper(Crates, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalc

[sqlalchemy] Re: Callback on save when value of field has changed?

2008-12-27 Thread Michael Bayer
On Dec 27, 2008, at 10:29 AM, Jim Jones wrote: > > Andreas Jung wrote: >> On 27.12.2008 11:06 Uhr, Jim Jones wrote: >>> Hi List, >>> >>> I have this simple model (in declarative style): >>> >>> class Item( Base ): >>> __tablename__ = 'items' >>> desc = Column( 'desc', UnicodeText(), nul

[sqlalchemy] Re: How can I know the state of an instances?

2008-12-27 Thread Michael Bayer
if instance in session: do something else: do something else alternatively, you can explicitly say elif instance in session.new: On Dec 27, 2008, at 4:35 AM, Chen Houwu wrote: > > I want to do as following: > > if instance is Transient: > do something > else instance is Pen

[sqlalchemy] Re: Callback on save when value of field has changed?

2008-12-27 Thread Jim Jones
Andreas Jung wrote: > On 27.12.2008 11:06 Uhr, Jim Jones wrote: > > Hi List, > > > > I have this simple model (in declarative style): > > > > class Item( Base ): > > __tablename__ = 'items' > > desc = Column( 'desc', UnicodeText(), nullable=False ) > > email = Column( 'email', Unic

[sqlalchemy] Re: Callback on save when value of field has changed?

2008-12-27 Thread Andreas Jung
On 27.12.2008 11:06 Uhr, Jim Jones wrote: > Hi List, > > I have this simple model (in declarative style): > > class Item( Base ): > __tablename__ = 'items' > desc = Column( 'desc', UnicodeText(), nullable=False ) > email = Column( 'email', UnicodeText(), nullable=False ) > > How can

[sqlalchemy] Callback on save when value of field has changed?

2008-12-27 Thread Jim Jones
Hi List, I have this simple model (in declarative style): class Item( Base ): __tablename__ = 'items' desc = Column( 'desc', UnicodeText(), nullable=False ) email = Column( 'email', UnicodeText(), nullable=False ) How can I trigger an event when the value of 'desc' has changed and

[sqlalchemy] Re: Updating existing objects

2008-12-27 Thread Eric Abrahamsen
On Dec 27, 2008, at 1:39 PM, Andreas Jung wrote: > On 27.12.2008 3:06 Uhr, Eric Abrahamsen wrote: >> Sorry for the very beginner question, but I haven't been able to find >> a good discussion of this issue online (possibly because it's too >> basic). >> >> I'm using sqlalchemy as part of a basic

[sqlalchemy] How can I know the state of an instances?

2008-12-27 Thread Chen Houwu
I want to do as following: if instance is Transient: do something else instance is Pending: do something else How can I accomplish it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To pos

[sqlalchemy] Re: using key parameter at column definition

2008-12-27 Thread Michael Bayer
"schema" has to match as well. your groups_table has no "schema=". so it would match to "tg_group.group_id". also please use all lower case letters unless you require exact casing. http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/schema.html#sqlalchemy.schema.Column --~--~---