[sqlalchemy] MySQL significant order in set list of update command

2011-12-10 Thread bogun . dmitriy
Hi, All. I have found unexpected behaviour of MySQL DB. In update command order of operations in set list is significant. I need to switch values of 2 rows. Better see example: mysql create temporary table sw_test (a integer not null, b integer not null, dummy integer); Query OK, 0 rows affected

[sqlalchemy] SqlAclhemy 0.6.8

2011-12-10 Thread Hector Blanco
Hello everyone! In my application, I have a class Product that can belong to a Category. (1 product, 1 category). The category knows which products belong to it thanks to a backref. A product can not exist if it doesn't belong to a category. If a category is deleted, all it's products are deleted

[sqlalchemy] SqlAclhemy 0.6.8 Delete orphan with objects that contain new objects (momentarily orphan)?

2011-12-10 Thread Hector Blanco
Sorry, I messed up the subject of the email -- Forwarded message -- From: Hector Blanco white.li...@gmail.com Date: 2011/12/10 Subject: SqlAclhemy 0.6.8 To: sqlalchemy@googlegroups.com Hello everyone! In my application, I have a class Product that can belong to a Category. (1

Re: [sqlalchemy] MySQL significant order in set list of update command

2011-12-10 Thread Michael Bayer
My impression was Postgresql handles this much more nicely which is confirmed by this post: http://beerpla.net/2009/02/17/swapping-column-values-in-mysql/ the usual way this kind of thing is done is via declaring local variables in the SQL statement, and an example of doing such using

Re: [sqlalchemy] SqlAclhemy 0.6.8 Delete orphan with objects that contain new objects (momentarily orphan)?

2011-12-10 Thread Michael Bayer
On Dec 10, 2011, at 7:07 PM, Hector Blanco wrote: That data (is JSON) is sent to the Category handler. That handler does the following 1) Creates a new Category() instance, 2) Fill the non-relationship fields (_name in this case) 3) Adds the category to the session, so it gets an _id

Re: [sqlalchemy] SqlAclhemy 0.6.8 Delete orphan with objects that contain new objects (momentarily orphan)?

2011-12-10 Thread Hector Blanco
Thank you for your reply. I'm not exactly sure of what is blocking the insert. I would say SqlAlchemy, because my Foreign Keys are nullable (which raises the question of whether it's a good design or not... but that's a different story) I read in the documentation:

Re: [sqlalchemy] SqlAclhemy 0.6.8 Delete orphan with objects that contain new objects (momentarily orphan)?

2011-12-10 Thread Michael Bayer
if you have a relationship() with delete-orphan, SQLAlchemy will not let you save the child without the parent being attached. It is more or less a bug in that this particular check is unnecessary, and you should upgrade to 0.7. On Dec 11, 2011, at 12:00 AM, Hector Blanco wrote: Thank you

Re: [sqlalchemy] SqlAclhemy 0.6.8 Delete orphan with objects that contain new objects (momentarily orphan)?

2011-12-10 Thread Hector Blanco
I would like to. I've been testing 0.7.4, and it seems to work really fast, but my code is heavily dependent on Synonyms, which seem to be incompatible with certain new features (I'm getting errors when I use order_by, for instance) so, until I have time to migrate my code to Hibrids, I'm afraid I