Re: Portable way to prepend string to all rows in a table

2012-12-06 Thread Javier Guerra Giraldez
On Thu, Dec 6, 2012 at 7:25 AM, Larry Martell wrote: >> >> orm['travelbox.AccommodationImage'].objects.all().update(file='travelbox/accommodation/' >> + F('url')) >> >> However that doesn't work - it executes the following SQL: >> >> UPDATE `travelbox_accommodationimage` SET `file` = >>

Re: Portable way to prepend string to all rows in a table

2012-12-06 Thread Larry Martell
On Thu, Dec 6, 2012 at 6:18 AM, Francis Devereux wrote: > Hi, > > I currently have the following code in one of my migrations: > > cursor = connection.cursor() > cursor.execute('''UPDATE travelbox_accommodationimage SET file = > CONCAT('travelbox/accommodation/', url)''') > transactio

Portable way to prepend string to all rows in a table

2012-12-06 Thread Francis Devereux
Hi, I currently have the following code in one of my migrations: cursor = connection.cursor() cursor.execute('''UPDATE travelbox_accommodationimage SET file = CONCAT('travelbox/accommodation/', url)''') transaction.commit_unless_managed() This works for us (on MySQL, which we are us