Re: [sqlalchemy] no prefix appended to column name when using column_property? (version 0.7.5)

2012-03-07 Thread Darren
thanks. I tried this approach and it is working much better now. On Tuesday, March 6, 2012 9:55:11 PM UTC, Michael Bayer wrote: On Mar 6, 2012, at 4:02 PM, Darren wrote: Also, is this the preferred way to scale values? I'd probably use @hybrid_property for this, that way you can

[sqlalchemy] no prefix appended to column name when using column_property? (version 0.7.5)

2012-03-06 Thread Darren
Hi, In my class definition I use a column_property: clp_price = column_property(Column(clp_price, BigInteger) / scale) The basic idea is that I wanted to apply a scale when the column is retrieved from the database. However, I noticed that the underlying SQL does not prefix this column name

[sqlalchemy] standard way of initializing an empty clause?

2011-06-10 Thread Darren Yin
= cond2_clause Because the and_ and or_ methods special case the single argument case (just passing them through), the simplest thing I've found to work is the and_(True, True) construct. But that's exceedingly hacky imo. Thanks in advance! --Darren -- You received this message because you

[sqlalchemy] Is there a way to generate this UPDATE statement?

2011-03-12 Thread Darren Yin
The MySQL documentation has the followinghttp://dev.mysql.com/doc/refman/5.1/en/update.htmlexample syntax for multi-table UPDATES: UPDATE items, month SET items.price=month.price WHERE items.id=month.id; Is there a way to generate that via SQLAlchemy? The closest thing to it I could find in the

[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread Darren Govoni
, especially for replication at the object layer. So is it true that this cannot currently be done with sqlalchemy? I have been reading the docs, but no clues yet. On Fri, 2009-01-16 at 16:53 -0500, Darren Govoni wrote: Hi, I have an object (with references) I get from a session on database

[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread Darren Govoni
the hierarchy-copying yourself - even if moving one object (alone) from session to session succeeds somehow. On Saturday 17 January 2009 14:47:41 Darren Govoni wrote: After some further experimenting with this, it seems I cannot take a mapped object I retrieved from one session and save

[sqlalchemy] Re: Migrating objects across sessions

2009-01-17 Thread Darren Govoni
u'll have to do the hierarchy-copying yourself - even if moving one object (alone) from session to session succeeds somehow. On Saturday 17 January 2009 14:47:41 Darren Govoni wrote: After some further experimenting with this, it seems I cannot take a mapped object I retrieved from one

[sqlalchemy] Migrating objects across sessions

2009-01-16 Thread Darren Govoni
Hi, I have an object (with references) I get from a session on database A and I want to copy it (deep copy) to database B. I tried expunging it from the first session and adding it to the second. What's the best practice to do this? thanks! Darren

[sqlalchemy] Does limit() work with update()?

2009-01-11 Thread Darren Govoni
query only perform the update on the limited results of the query? Darren --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Does limit() work with update()?

2009-01-11 Thread Darren Govoni
AM, Darren Govoni wrote: Hi, I have 2 records in the database. I made an expression to update only 1 record, but all are getting updated. works=session.query(Work).filter(tnow- Work.takentimedelta(minutes=15)) .filter (Work .completed==None).limit(1).with_lockmode(mode

[sqlalchemy] Re: Does limit() work with update()?

2009-01-11 Thread Darren Govoni
. B finds 1 row where FOO=NULL and sets FOO=B. B exits. Does that help clarify? thank you. On Sun, 2009-01-11 at 11:33 -0500, Michael Bayer wrote: On Jan 11, 2009, at 11:18 AM, Darren Govoni wrote: Thank you, So I changed my query to a select/for update. then re-added the updated

[sqlalchemy] Re: Does limit() work with update()?

2009-01-11 Thread Darren Govoni
, Michael Bayer wrote: On Jan 11, 2009, at 11:40 AM, Darren Govoni wrote: Sorry for the haze. I'm using PostgreSQL and am checking their docs on isolation to see that it is consistent with SA. but here is a simplified example. I have 2 rows in the database with 1 column FOO. Both rows

[sqlalchemy] Re: Self-Referential Mapping with Base?

2009-01-11 Thread Darren Govoni
Hi MikeCo, I tried your example, and got this error from SA 0.5. ValueError: need more than 0 values to unpack Darren On Fri, 2009-01-09 at 20:33 -0800, MikeCo wrote: from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base dbname

[sqlalchemy] Re: Self-Referential Mapping with Base?

2009-01-11 Thread Darren Govoni
Ahhh, looks like I'm on rc4. Let me try final and see. On Sun, 2009-01-11 at 13:10 -0500, Michael Bayer wrote: 0.5.0 final ? On Jan 11, 2009, at 12:21 PM, Darren Govoni wrote: Hi MikeCo, I tried your example, and got this error from SA 0.5. ValueError: need more than 0 values

[sqlalchemy] Re: Self-Referential Mapping with Base?

2009-01-10 Thread Darren Govoni
() - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - On Jan 9, 10:03 pm, Darren Govoni dar...@ontrenet.com wrote: Hi, Thanks for the response. I'm still fairly new to SA but am very impressed with this package! I tried a variety of combinations of mappings. If I use just the parent_id,parent it would seem to make sense

[sqlalchemy] Re: Self-Referential Mapping with Base?

2009-01-09 Thread Darren Govoni
Hi, Thanks for the response. I'm still fairly new to SA but am very impressed with this package! I tried a variety of combinations of mappings. If I use just the parent_id,parent it would seem to make sense logically if my children only have one parent. The tables generate fine. But when I