Re: [sqlalchemy] LIMIT the number of children in relationship dynamically

2017-05-02 Thread mike bayer
On 05/02/2017 12:38 AM, Isaac Martin wrote: Thank you very much for your response. This solution isn't working for me, and I'm 99% sure I'm not translating what you've written into something that works for my use case. My situation is somewhat more complicated than I initially wrote. My first

Re: [sqlalchemy] LIMIT the number of children in relationship dynamically

2017-05-01 Thread Isaac Martin
Well that was a very silly mistake. End of the day oversight is what happened here. I didn't notice that "offset" was set to 10 and my unit test only had 2 values. When I set offset to 0 it worked great. Sincerest thanks for this! I hadn't seen as_scalar used before. I'm looking forward to trying

Re: [sqlalchemy] LIMIT the number of children in relationship dynamically

2017-05-01 Thread Isaac Martin
Thank you very much for your response. This solution isn't working for me, and I'm 99% sure I'm not translating what you've written into something that works for my use case. My situation is somewhat more complicated than I initially wrote. My first question was in the vain hope that there was some

Re: [sqlalchemy] LIMIT the number of children in relationship dynamically

2017-05-01 Thread mike bayer
On 05/01/2017 08:05 PM, Isaac Martin wrote: I am building an api which can return children of resources if the user requests it. For example, |user| has |messages|. I want the query to be able to limit the number of |message| objects that are returned. I found a useful tip about limiting t

[sqlalchemy] LIMIT the number of children in relationship dynamically

2017-05-01 Thread Isaac Martin
I am building an api which can return children of resources if the user requests it. For example, user has messages. I want the query to be able to limit the number of message objects that are returned. I found a useful tip about limiting the number of objects in child collections here