[sqlalchemy] using func.concat() inside an update() call doesn't work
It seems like the following update call is forcing func.concat to be a string: connection.execute(note_table.update( table.c.id==1, notes = func.concat(note_table.c.notes, 'NEW NOTE TO BE ADDED') ) ) This generates the following sql: UPDATE note_table SET notes='CONCAT(note_table.notes, %s)' WHERE note_table.id = 1; --~--~-~--~~~---~--~~ 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 from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: using func.concat() inside an update() call doesn't work
Great, thanks. That works. Jim On Jan 31, 10:53 am, Michael Bayer [EMAIL PROTECTED] wrote: I cant reproduce that exact outcome but to specify the SET clause of an UPDATE, you want to use the values keyword: table.update(table.c.id==1, values={'notes':func.concat(table.c.nodes, 'FOO')}) Also, you dont even need to use func.concat here as just saying table.c.nodes + 'FOO' will generate the appropriate concatenation construct. On Jan 31, 2008, at 11:45 AM, Jim Musil wrote: It seems like the following update call is forcing func.concat to be a string: connection.execute(note_table.update( table.c.id==1, notes = func.concat(note_table.c.notes, 'NEW NOTE TO BE ADDED') ) ) This generates the following sql: UPDATE note_table SET notes='CONCAT(note_table.notes, %s)' WHERE note_table.id = 1; --~--~-~--~~~---~--~~ 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 from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Can orm Query return an empty instance when no results are found?
Hi, this is probably a basic question, but I'm a little fuzzy on the best approach. Is there a way to retrieve OR create an object with just one call? It seems like I'm always doing the same pattern: 1. Look in table for existing record 2. return object if already exists 3. create and new object if it doesn't exist It'd be nice if Query() could look for an object and return it, or return a new instance if it doesn't find it. Perhaps this is too much of a short cut... Jim --~--~-~--~~~---~--~~ 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 from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] LIMIT in update()
Hi, I'm trying to determine a way to append a LIMIT to an update() object. Is the solution a correlated update on the same table with the LIMIT on the select() object? Cheers, Jim --~--~-~--~~~---~--~~ 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 from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] RLIKE, REGEXP
I don't see support for RLIKE, NOT RLIKE, or REGEXP anywhere. Is there support for this? Jim --~--~-~--~~~---~--~~ 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 from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: INSERT IGNORE
Thanks! On Oct 3, 9:13 am, Michael Bayer [EMAIL PROTECTED] wrote: ive added ticket #804 for this. On Oct 1, 2007, at 5:35 PM, Jim Musil wrote: I'm not seeing the ability to use the INSERT IGNORE ... syntax. Is this available anywhere? Jim Musil --~--~-~--~~~---~--~~ 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 from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] INSERT IGNORE
I'm not seeing the ability to use the INSERT IGNORE ... syntax. Is this available anywhere? Jim Musil --~--~-~--~~~---~--~~ 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 from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---