[sqlalchemy] Result of a table.update()

2010-10-21 Thread Warwick Prince
Hi All

I'm using 0.6.4 under Windoze with MySQL,  Python 2.6.4 and I had code that I 
thought worked before (0.6.3)  - which appeared to break due to this issue.. I 
could be wrong on this point so I'll just get to the crux of the matter...

I have a result = table.update(whereClause, values=someValuesDict).execute()

The table is updated correctly, however, the resultproxy object I receive as 
'result' appears to have no members.   If I fetchone() or fetchall() I simply 
get a None result.  Is this correct?

If this IS correct, how is the best way to tell if the update was a success?   
I tried putting bad data in the whereClause and it simply did nothing to the 
database, but my resultproxy was the same.  No Exceptions raised in either case?

Please enlighten me..

Cheers
Warwick


Warwick Prince 
Managing Director 
mobile: +61 411 026 992 
skype: warwickprince  
 
phone: +61 7 3102 3730 
fax:  +61 7 3319 6734 
web: www.mushroomsys.com 


-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] Result of a table.update()

2010-10-21 Thread Michael Bayer
an UPDATE statement returns no rows unless RETURNING was used to return columns 
from those rows that were updated.   When an UPDATE or DELETE is emitted, 
result.rowcount contains the number of rows that were matched by the 
statement's criterion.

On Oct 21, 2010, at 2:06 AM, Warwick Prince wrote:

 Hi All
 
 I'm using 0.6.4 under Windoze with MySQL,  Python 2.6.4 and I had code that I 
 thought worked before (0.6.3)  - which appeared to break due to this issue.. 
 I could be wrong on this point so I'll just get to the crux of the matter...
 
 I have a result = table.update(whereClause, values=someValuesDict).execute()
 
 The table is updated correctly, however, the resultproxy object I receive as 
 'result' appears to have no members.   If I fetchone() or fetchall() I simply 
 get a None result.  Is this correct?
 
 If this IS correct, how is the best way to tell if the update was a success?  
  I tried putting bad data in the whereClause and it simply did nothing to the 
 database, but my resultproxy was the same.  No Exceptions raised in either 
 case?
 
 Please enlighten me..
 
 Cheers
 Warwick
 
 
 Warwick Prince 
 Managing Director 
 mobile: +61 411 026 992 
 skype: warwickprince  
  
 phone: +61 7 3102 3730 
 fax:  +61 7 3319 6734 
 web: www.mushroomsys.com 
 
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To post to this group, send email to sqlalch...@googlegroups.com.
 To unsubscribe from this group, send email to 
 sqlalchemy+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/sqlalchemy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] Result of a table.update()

2010-10-21 Thread Warwick Prince
HI Michael

Thanks for the info.  .rowcount was the missing link I needed.  I'll also play 
with RETURNING as well as I thought I had tried that at one stage and saw no 
change in the SQL emitted, so moved on.   I'll let you know.

Cheers
Warwick

 an UPDATE statement returns no rows unless RETURNING was used to return 
 columns from those rows that were updated.   When an UPDATE or DELETE is 
 emitted, result.rowcount contains the number of rows that were matched by the 
 statement's criterion.
 
 On Oct 21, 2010, at 2:06 AM, Warwick Prince wrote:
 
 Hi All
 
 I'm using 0.6.4 under Windoze with MySQL,  Python 2.6.4 and I had code that 
 I thought worked before (0.6.3)  - which appeared to break due to this 
 issue.. I could be wrong on this point so I'll just get to the crux of the 
 matter...
 
 I have a result = table.update(whereClause, values=someValuesDict).execute()
 
 The table is updated correctly, however, the resultproxy object I receive as 
 'result' appears to have no members.   If I fetchone() or fetchall() I 
 simply get a None result.  Is this correct?
 
 If this IS correct, how is the best way to tell if the update was a success? 
   I tried putting bad data in the whereClause and it simply did nothing to 
 the database, but my resultproxy was the same.  No Exceptions raised in 
 either case?
 
 Please enlighten me..
 
 Cheers
 Warwick
 
 
 Warwick Prince 
 Managing Director 
 mobile: +61 411 026 992 
 skype: warwickprince  
  
 phone: +61 7 3102 3730 
 fax:  +61 7 3319 6734 
 web: www.mushroomsys.com 
 
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To post to this group, send email to sqlalch...@googlegroups.com.
 To unsubscribe from this group, send email to 
 sqlalchemy+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/sqlalchemy?hl=en.
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To post to this group, send email to sqlalch...@googlegroups.com.
 To unsubscribe from this group, send email to 
 sqlalchemy+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/sqlalchemy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.