<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hmm, I dunno ADOpy but assume it somehow miraculously turns your data<br>set into a dictionary of some sort? How it guesses which order the
<br>SELECT will return the fields is a mystery to me, but maybe it has<br>knowledge of the Postgres hashing function or somesuch.</blockquote>
<div>Yeah. I used to do it by hand by looking at the description of the cursor object, which holds the name of each field as defined in the database with other stuff. You can then get the field value by getting the index of the field name, then hitting the row data. It's not a lot of fun, but I did it because I didn't want to depend on the order being returned in case we wanted to drop a field for some reason.
<div>> Here's what works for me (and a tip-o-the-hat to Bob Gailer for his<br>help)<br>><br>> query = '''UPDATE my_table SET state = 'processed' WHERE id IN %s'''<br>%<br>> str(ids_to_process)<br>> query =
query.replace('[', '(')<br><br>>Why not convert the list to a tuple before applying str():<br><br>>str(tuple(ids_to_process))<br> </div>
<div>Didn't think of it...thanks :-)<br><br>>Unless ADOpy is very slow I wouldn't expect a huge performance<br>>increase since it will only be the compile phase, but if you<br>>hit the query a lot then maybe 5-10%. You are more likely to
<br>>see the benefit in a drop CPU loading on the server.<br> </div>
<div>Which is good, too.<br> </div></div><br>