The limit() function behaves in a way that is possibly unexpected: If you ask sqlalchemy to query "limit(3)" where a join is involved, for example, and 2 of the "top-3" are actually the same primary key, sqlalchemy gets the 3 results, throws out the duplicate and your query size ends up as 2. This gives the impression there are no more matches because you asked for 3 and got only 2, when in fact you may have hundreds of possible rows.
Right off, I can't think of an elegant solution to this behavior. Certainly sqlalchemy could *detect* the problem after the fact and re- request a greater limit, but that is ugly hackish and results in multiple trips to the database, sqla wouldn't know how many to re- request, etc... sqlalchemy could request "DISTINCT" results, but I'm not sure how easily that could be implemented or what it may break. Interested if anyone has an elegant solution?
-- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.