[sqlalchemy] Re: BETWEEN in where clause?

2007-06-29 Thread svilen
the between should be in the where clause, NOT the columns that u fetch. Read about select() and how to specify columns and how to specify where's.. Thanks for your reply,now I dont have errors, but the results are unexpected, I have a list of booleans if I iterate through the result

[sqlalchemy] Re: column_prefix with synonym

2007-06-29 Thread svilen
if youre trying to lock down __dict__ and all that with magic, i think you need to instead get better users :). its python, its unrealistic to try to make a java-sandboxlike application that cant be messed with. stop with this java labeling. think wider. java is just some (poor) language

[sqlalchemy] How to lock using sqlalchemy

2007-06-29 Thread mc
Hi, I need to lock a table for WRITE. The scenario is that I have a SELECT followed by an INSERT, where the INSERT depends on the outcome of the SELECT. I have to make sure that no other process is modifying the table after my SELECT but before my INSERT. 1) How do i do it via SQLAlchemy ? 2) Is

[sqlalchemy] Re: How to lock using sqlalchemy

2007-06-29 Thread Andreas Jung
At least the select() method has an optional parameter 'lockmode'. You might check the docs and the release notes. -aj --On 29. Juni 2007 08:23:16 + mc [EMAIL PROTECTED] wrote: Hi, I need to lock a table for WRITE. The scenario is that I have a SELECT followed by an INSERT, where the

[sqlalchemy] Re: BETWEEN in where clause?

2007-06-29 Thread voltron
aha, this works resultset = select([links] , links.c.lft.between(5,17), order_by=links.c.lft).execute() On Jun 29, 12:00 am, voltron [EMAIL PROTECTED] wrote: Thanks for your reply,now I dont have errors, but the results are unexpected, I have a list of booleans if I iterate through the result

[sqlalchemy] SAContext and transactions?

2007-06-29 Thread voltron
I´m not sure if I should ask this here or the Pylons forum: How does one wrap a query in a transaction when using SAContext? Could someone post some example code? Also, I read somewhere that SQL92 defined transactions eliminate the need to lock tables, is that right? Thanks

[sqlalchemy] Re: How to lock using sqlalchemy

2007-06-29 Thread Michael Bayer
On Jun 29, 2007, at 4:23 AM, mc wrote: Hi, I need to lock a table for WRITE. The scenario is that I have a SELECT followed by an INSERT, where the INSERT depends on the outcome of the SELECT. I have to make sure that no other process is modifying the table after my SELECT but before my

[sqlalchemy] Re: How to lock using sqlalchemy

2007-06-29 Thread Michael Bayer
On Jun 29, 2007, at 4:55 AM, Andreas Jung wrote: At least the select() method has an optional parameter 'lockmode'. You might check the docs and the release notes. lockmode is specific to the ORM. these days it looks like query.with_lockmode('read').filter(...).. it results in FOR

[sqlalchemy] how to leave cascade up to the database

2007-06-29 Thread Huy Do
Hi, How do I configure my mapper/table to leave the cascade up to my database. i.e I don't want SA to auto update or delete my child objects when I delete or update my parent object. Thanks Huy --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Re: SAContext and transactions?

2007-06-29 Thread Mike Orr
On 6/29/07, voltron [EMAIL PROTECTED] wrote: I´m not sure if I should ask this here or the Pylons forum: Here, but I haven't introduced SAContext here yet. SAContext is a little top-level organizer for engines, metadatas, and a session context. It was written for Pylons due to the confusion

[sqlalchemy] Re: SAContext and transactions?

2007-06-29 Thread sdobrev
SAContext is a little top-level organizer for engines, metadatas, and a session context. It was written for Pylons due to the confusion people were having setting up their models, but the SAContext class itself can be used in any SQLAlchemy application.

[sqlalchemy] Re: how to leave cascade up to the database

2007-06-29 Thread Michael Bayer
On Jun 29, 2007, at 10:38 AM, Huy Do wrote: Hi, How do I configure my mapper/table to leave the cascade up to my database. i.e I don't want SA to auto update or delete my child objects when I delete or update my parent object. you are probably looking for passive_deletes=True on

[sqlalchemy] Re: SAContext and transactions?

2007-06-29 Thread Mike Orr
On 6/29/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: http://sluggo.scrapping.cc/python/sacontext/ hmm, why have i invented same thing 8 months ago... Anyway. for a reason or another u dont have any destroy operations there. It's only a container. Its main job is to preserve the right

[sqlalchemy] Re: SAContext and transactions?

2007-06-29 Thread sdobrev
it's all okay. i just thought that if it is a Context, u should have some destructors - as u call many constructors. otherwise it is not reentrant - or at least repeatable. But if the idea is that this context will always be one-and-only, lives forever, and all db-stuff will happen within

[sqlalchemy] Re: SAContext and transactions?

2007-06-29 Thread Mike Orr
On 6/29/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: it's all okay. i just thought that if it is a Context, u should have some destructors - as u call many constructors. otherwise it is not reentrant - or at least repeatable. I only call it context because Mike uses the word for session

[sqlalchemy] major help required with SQLAlchemy and Turbogears.

2007-06-29 Thread SamDonaldson
I wrote my own custom update statement. It's a simple update statement, When I run the update on mysql, I get the result as expected, i.e., the table is emtpy, so no rows affected, nothing done. When I run it in my Tg script, it runs once, and boom, it stalls on this: result =