On Friday, March 02, 2012 08:57:30 PM Ricardo Araoz wrote: > El 02/03/12 20:24, Paul McNett escribió: > > On 3/2/12 2:58 PM, Ricardo Araoz wrote: > >> Let's say your large SQL statement has millions of rows and you want > >> to > >> group those rows in one data set and you want a subset of those rows > >> in > >> another data set. I'd rather recieve two datasets with 100 rows each > >> (and processed in the dbms) than several million rows in one dataset > >> and > >> having to process it locally to obtain both final data set results. > > > > Python's dbapi provides for this with cursor.fetchmany(num_rows). Dabo > > does not provide for this as it stands, because we always do > > cursor.fetchall(). > Wouldn't that be fetching sets of rows of the SAME data set? > What I need is to recieve two data sets from a single instruction. > query = """ > select * > into #TempTable > from someBigTable > left join someOtherTable > on someConditions > where someRestraints > > select someField, someOtherField, sum(someValue) as 'Total' > from #TempTable > group by someField, someOtherField > order by someField, someOtherField > > select * > from #TempTable > left join #OtherTempTableFromSomeOtherPreviousQuery > on SomeConditions > where someOtherRestraints > """ > If I sent this query to the dbms from VFP I would recieve two cursors, > whose names would be by default (you may specify other) "cursor" and > "cursor1". > The "query" is defined by the user, so there is no way I may think of > better or worse strategies, I want to get two different data sets so > that I may later include them in a spread sheet or a csv file.
What is wrong with: def getTwoDataSets(self, query1, query2): dataSet1 = doSomethingWithQuery1 dataSet2 = doSomethingWithQuery2 return dataSet1,dataSet2 cursor1, cursor2 = getTwoDataSets("where pkid = 1", "where pkid =15") Johnf Johnf _______________________________________________ Post Messages to: Dabo-users@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/2233470.vyPhYIkV3P@linux-12