Query(), when called with entity classes as arguments, returns only unique
entities or unique combinations thereof.   to get the raw data call Query
with columns/attributes as arguments instead.


DavidG wrote:
>
> Hi,
>
> I can give all the details, but let's start with a simple question.
>
> I have a query, and it is returning the wrong number of rows!
>
> Not only is the number wrong compared to what I would expect, but,
> more importantly, when I paste the *exact sql* (except for
> substituting a param) printed on the console with "echo on" into the
> mysql prompt, the results are exactly what I would expect.
>
> What, if anything, is known to cause the "printed sql" to give a
> different result then sqlalchemy itself?
>
> I am using:
> sqlalchemy-0.5.5
> mysql
> python 2.6.2
>
> I am using the orm, and I am doing basically:
>
> recs = q.all()
> print "len(recs)=", len(recs)
>
> where q is the query.
>
> Sample:
>
> username = u'steve'
> subq = SES.query(Feedback).filter(Feedback.username ==
> username).subquery()
> valias = aliased(Feedback, subq)
> q = SES.query(Quote, valias).order_by(desc(Quote.n_votes)).outerjoin
> (Quote.feedback, valias).limit(2)
>
> Without the limit(), I get all the records (>1000), which seem
> correct. *With* the limit, the number of records is completely kookie
> (to me!). It seems to be always *less* then what the actual limit is.
>
> But again, the sql printed on the console gives me the correct
> results!
>
> Any help would be most appreciated! Thank you. I will happily furnish
> more details if needed.
>
> David
>
>
> >
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to