Here is what I am doing now (even forgetting the limit):
-
username = u'hal'
subq = SES.query(Bar).filter(Bar.username == username).\
subquery()
valias = aliased(Bar, subq)
q = SES.query(Foo, valias).order_by(Foo.mdata).\
outerjoin(Foo.bar, valias)
recs = q.all()
pr
I guess I should restate the question.
I have two tables:
class Foo(Base):
__tablename__ = 'foo'
id = Column(Integer, primary_key=True)
mdata = Column(UnicodeText)
bar = relation("Bar")
def __repr__(self):
return "Foo(%r)" % self.mdata
class Bar(Base):
__tabl
Thanks, Mike. I'll work on that. I do have a test case, but there
everything works fine. There must be something in my real data. I just
can't figure it out what it is!
D.
On Aug 24, 8:45 pm, Michael Bayer wrote:
> On Aug 24, 2009, at 7:44 PM, DavidG wrote:
>
>
>
> > First, there is at most a s
On Aug 24, 2009, at 7:44 PM, DavidG wrote:
>
> First, there is at most a single Feedback record (for a given user,
> hence the subquery) per quote (and in the one case I have been banging
> my head on, I am certain of this).
>
> And this: why would I get different results from pasting the echoe
First, there is at most a single Feedback record (for a given user,
hence the subquery) per quote (and in the one case I have been banging
my head on, I am certain of this).
And this: why would I get different results from pasting the echoed
sql into the online mysql query vs from sqlalchemy dir
DavidG wrote:
>
> Hi Mike -
>
> Confused. Why would it be different with the limit() or not?
well there's not enough detail to say exactly but you're applying the
limit() to a query with outer join. So if Quote number one had five
related Feedback entries, you'd get one row back for all five of
Hi Mike -
Confused. Why would it be different with the limit() or not? Without
the limit() I get *all* the Quote records (>1000) which is correct. If
I have something like limit(10), I'll get *less then 10*.
Also, I didn't know about the "unique entities" limitation. In any
event, the Quote obje
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