On Aug 2, 2011, at 12:09 PM, RVince wrote:
> Michael,
>
> But if I do the following, and do NOT close it (at least, I dont
> believe I am now):
>
> result = engine.execute("select
> current_disposition_code,count(*) as num from cms_input_file group by
> current_disposition_code;")
> c.curent_disposition_codes = []
> c.num = []
> for row in result:
>
> c.curent_disposition_codes.append(str(row['current_disposition_code']))
> c.num.append(str(row['num'] ))
>
> And I look in at c.curent_disposition_codes and c.num, and I see 4
> values for each, then, when I go to render it with:
>
> <%
> i = 0
> %>
> % for result in c.current_disposition_codes:
> ${result}[${c.num.index(i)}]
> <%
> i = i + 1
> %>
> % endfor
In this case you are running through the result proxy in your controller,
assigning to a collection, and its done. That is perfectly fine. Feel free
to close out the connection after iterating the result set.
Then, it is unusual that you're indexing what is basically a string, i.e. each
value of "result" with the [] operator though.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.