<div><span class="gmail_quote">On 3/29/06, <b class="gmail_sendername">Ian Bicking</b> &lt;<a href="mailto:ianb@colorstudy.com">ianb@colorstudy.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Greg Ewing wrote:<br>&gt; On 3/29/06, Adam DePrince &lt;<a href="mailto:adam.deprince@gmail.com">adam.deprince@gmail.com</a>&gt; wrote:<br>&gt;<br>&gt;&gt;&gt;&gt;&gt; rs.execute( &quot;select upc, description, price from my_table&quot; )
<br>&gt;&gt;&gt;&gt;&gt; data = rs.fetch().fieldby( 'price','upc')<br>&gt;&gt;&gt;&gt;&gt; print type( data )<br>&gt;&gt; &lt;MultiViewMapping&gt;<br>&gt;<br>&gt; Seems to me it would be a better idea for the DB<br>&gt; module to return tuple-with-attributes objects for
<br>&gt; the rows in the first place, rather than plain<br>&gt; tuples.<br>&gt;<br>&gt; When I get around to reworking my custom Firebird<br>&gt; module, I'm going to make it do that.</blockquote><div><br>See the db_row module from 
<a href="http://opensource.theopalgroup.com/">http://opensource.theopalgroup.com/</a>.&nbsp; It attempts to provide a tuple-looking (sequence-like) object that also provides &quot;object-like&quot; and &quot;mapping-like&quot; interfaces that is both space and time efficient.&nbsp; While being far from a perfect solution, it does solve many practical problems and is used by many.
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Which is off-topic here, except to say that a view on the tuple would be<br>
useful in a way that returning a fancy tuple would not, because it could<br>wrap any DB-API-compliant result set.&nbsp;&nbsp;Which might still be off-topic,<br>since the implementation of that particular view would be mostly<br>unrelated to any other view we've talked about here.&nbsp;&nbsp;Except perhaps to
<br>note that patterns for building light and fast views would also be nice.</blockquote><div><br><br>db_api result sets are the tip of the iceberg, though an important start.&nbsp; These annotated tuples can also be used in many other bulk data processing contexts where metadata is either implicit or decoupled with the data values -- 
e.g., processing csv files with the csv module.<br></div></div><br><br>-Kevin<br><br>