database cursors are essentially iterators so a total rowcount, without
fetching all the rows, is not available in a platform-agnostic way.

the usual strategy to find out how many rows of something exist in the DB
is to do SELECT COUNT(*).


Stephen Emslie wrote:
>
> Well, I would have expected ResultProxy.rowcount to do just that
> (return the number of rows in the last executed statement) but I just
> get 0 from it. Perhaps someone could explain how to use it correctly.
>
>
> Stephen Emslie
>
> On Thu, Mar 12, 2009 at 5:20 PM, jeff <[email protected]> wrote:
>>
>> hi. this question should be easy. i've searched around though and
>> haven't found the answer. all i want to do is know the number of
>> records in a result set i get using an execute statement with a simple
>> select. so if i do:
>>
>> s=select([raw_table],and_(raw_table.c.name==m
>> ['name'],raw_table.c.as_of>=i['first_time']))
>> rec_list=conn.execute(s)
>>
>> is there a simple way to get back the number of records that exist in
>> rec_list?
>>
>> thanks, i'm sure it's simple and i missed something.
>>
>> >
>>
>
> >
>


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to