[sqlalchemy] Re: Custom ID Generator

2009-09-28 Thread Naresh Khalasi
Thanks Mike for all the explanations. On Mon, Sep 28, 2009 at 7:54 AM, Michael Bayer mike...@zzzcomputing.com wrote: nkhalasi wrote: However with this I am getting unwanted commits. Essentially when the newid(ctx) function executes the update it also does an commit which results into my

[sqlalchemy] Re: How to replace a property in a declarative way

2009-09-28 Thread Kees van den Broek
Here is how I would construct the colors relation (put this inside the Product declaration): Hi Conor, Thank you for your documented implementation. Works as advertised! Cheers, Kees --~--~-~--~~~---~--~~ You received this message because you are subscribed

[sqlalchemy] session.query object instead rowtuple

2009-09-28 Thread Christian Démolis
Hi everybody, I have a little problem with session.query. I try to optimize my queries with only attributes that i need. When we impose attribute, sqlalchemy return a rowtuple s = session.query(IdFile, NameFile) When we don't impose attribute, the return is the object s = session.query(File) Is

[sqlalchemy] Re: session.query object instead rowtuple

2009-09-28 Thread Mike Conley
The column is available as e.Namefile, no need to subscript with numbers. On Mon, Sep 28, 2009 at 6:07 AM, Christian Démolis christiandemo...@gmail.com wrote: Hi everybody, I have a little problem with session.query. I try to optimize my queries with only attributes that i need. When we

[sqlalchemy] Re: NULL values sorting

2009-09-28 Thread alex9999
Sorry, I forgot. code0 is String values. and ordering like '001', '002', '043', '321', None --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] Re: NULL values sorting

2009-09-28 Thread Randall Nortman
Coalesce will still work fine. Just use a string with an an appropriate sorting order in place of REALLY_BIG_VALUE. On Sep 28, 8:24 am, alex alexlp9...@gmail.com wrote: Sorry, I forgot. code0 is String values. and ordering like '001', '002', '043', '321', None

[sqlalchemy] Re: session.query object instead rowtuple

2009-09-28 Thread Christian Démolis
Ok thanks 2009/9/28 Mike Conley mconl...@gmail.com The column is available as e.Namefile, no need to subscript with numbers. On Mon, Sep 28, 2009 at 6:07 AM, Christian Démolis christiandemo...@gmail.com wrote: Hi everybody, I have a little problem with session.query. I try to

[sqlalchemy] Re: session.query object instead rowtuple

2009-09-28 Thread Alexandre Conrad
2009/9/28 Christian Démolis christiandemo...@gmail.com: I need it to avoid  write this in my code for e in s:    print e[0] it's more difficult to read than From a readability point of view, you could use unpacking in your loop: for foo, bar in ((foo1, bar1), (foo2, bar2)): ... print

[sqlalchemy] Re: Circular Dependancy Hell

2009-09-28 Thread Ryan Michael
I cannot thank you enough - this has been driving me crazy. Your solution works great. I also worked out that you can get create_all() to work by adding use_alter=True to the foreignkey definition thumbnail_id=Column('thumbnail_id',Integer, ForeignKey('image.id', use_alter=True,

[sqlalchemy] postgresql vs os.fork()

2009-09-28 Thread Богун Дмитрий
Hello. I have an application - it store it's state in DB, when it need change object - it need change in in DB and in real world. So I create session with autocommit=False, make changes for DB objects, make changes on real world objects and if everything OK, commit session. In theory everything

[sqlalchemy] reflected tables and defaults

2009-09-28 Thread Jon Nelson
Is there a way to add a default to a column for a table that is autoreflected? I'm not even sure that's what I want to do, because what I *want* to do is this: Whenever an instance of Car is pulled from the database, I would like to make sure that it has an Engine associated with it, even if no

[sqlalchemy] Re: Remove need for session in method?

2009-09-28 Thread thatsanicehatyouhave
Hi Tomasz, Thanks for your help - that solved the problem. On 26 Sep 2009, at 10:20, Tomasz Jezierski - Tefnet wrote: [...code snipped...] First... why don't you define this method with class definition? I don't use reflection but I think that it is possible... It's a

[sqlalchemy] Re: Remove need for session in method?

2009-09-28 Thread Conor Davis
thatsanicehatyouh...@mac.com wrote: Hi Tomasz, Thanks for your help - that solved the problem. On 26 Sep 2009, at 10:20, Tomasz Jezierski - Tefnet wrote: [...code snipped...] First... why don't you define this method with class definition? I don't use reflection but I think that

[sqlalchemy] Relation using = operator and literal values

2009-09-28 Thread Wyatt Lee Baldwin
I have a relation defined like this in a declarative-style class: route = relation( RouteDef, primaryjoin=( (route_number == RouteDef.route_number) (route_begin_date = RouteDef.route_begin_date) ), ) What I *really* want is for

[sqlalchemy] Re: Custom ID Generator

2009-09-28 Thread nkhalasi
Thanks Mike and Connor for your advise. This is what finally worked for me as a ID generator hook. I tested it by forcing an exception to verify that the ID generator transaction and the transaction within my application logic (via the session) are seperate and independent. def newid1(ctx):