updateSome() has difficulty with WHERE arguments
Matthew Bogosian <[email protected]> Thu, 18 Aug 2005 22:15:29 -0700
| Newsgroups | gmane.comp.web.skunkweb |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I will be the first to admit that I have no idea what kind of voodoo
magic goes on in the updateSome method, but I have noticed a behavior
that seems to be erroneous.
According to the documentation, updateSome can take additional
arguments (just like getSome) which refine which rows will receive the
updates. However, the values given in the first argument (the dict)
seem to be ignored if the subsequent argument is present. For example,
I can do...
MyTable.updateSome({'some_value': 0})
...and it works. However, when I do...
My_table.updateSome({'some_value': 0}, 'some_other_value = %s AND
some_other_other_value = %s', 1, 2)
...I receive an exception:
ProgrammingError: not enough arguments for format string
I printed out "sqlbuff" and "values" right before the line...
> return conn.execute(''.join(sqlbuff), values)
...in pydo/base.py in the updateSome() classmethod. I got this...
> ['UPDATE ', 'my_table', ' SET ', 'some_value = %s']
> [0]
...for the first call (without the where clause), and this...
> ['UPDATE ', 'my_table', ' SET ', 'some_value = %s', ' WHERE ',
> 'some_other_value = %s AND some_other_other_value = %s']
> (1L, 2L)
...for the second call (with the where clause).
In the second call, it looks like the value in the dict is not
reflected in "values". However, since it's not straightforward to me
how "values" is constructed in the absence of the WHERE clause, I don't
know how to begin debugging this. One curious thing I did note though
was that in the first call, values is a list and the value is an
integer, whereas in the second, it's a tuple, and the values are both
long integers.
-- Matt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Darwin)
iD8DBQFDBWr3nLpDzL5I7l8RAuI/AJ9V9TtwqKbXlujk7alJwrePLJnmJwCfas6F
ER4mAaEbS6pvvqH8Sn384js=
=Cx37
-----END PGP SIGNATURE-----
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf