Re: [sqlalchemy] Relationship with query time evaluated primaryjoin

2016-08-09 Thread Florian Rüchel
Thanks for the explanation. I don't need a quick fix for my use-case. The problem only happens when writing tests and there I can just build a manual reload when I know the object is expired (I expire it manually on purpose). On 08/09/2016 01:17 AM, Mike Bayer wrote: > > > On 08/08/2016 07:43 AM

Re: [sqlalchemy] Relationship with query time evaluated primaryjoin

2016-08-08 Thread Mike Bayer
On 08/08/2016 07:43 AM, Florian Rüchel wrote: I created a gist that recreates the issue when running SQLAlchemy 1.1.0b3: https://gist.github.com/Javex/41c58b098c1e5736cb2b21c4b6708be3 great test. So this is to do with the lazy loader which is not expecting to see what it's seeing here.b

Re: [sqlalchemy] Relationship with query time evaluated primaryjoin

2016-08-08 Thread Florian Rüchel
I created a gist that recreates the issue when running SQLAlchemy 1.1.0b3: https://gist.github.com/Javex/41c58b098c1e5736cb2b21c4b6708be3 Traceback (most recent call last): File "broken_autojoin.py", line 73, in print('Title: %s' %article.german.title) File "/home/javex/.virtualenvs/mtc

Re: [sqlalchemy] Relationship with query time evaluated primaryjoin

2016-08-07 Thread Mike Bayer
On 08/06/2016 08:03 PM, Florian Rüchel wrote: Following up on this. I have implemented it in my application and it works beautifully when querying for the object. However, while writing tests, I discovered that if the object is expired, it doesn't know how to refresh it. To explain the issue,

Re: [sqlalchemy] Relationship with query time evaluated primaryjoin

2016-08-06 Thread Florian Rüchel
Following up on this. I have implemented it in my application and it works beautifully when querying for the object. However, while writing tests, I discovered that if the object is expired, it doesn't know how to refresh it. To explain the issue, I need to expand my original (simplified) examp

Re: [sqlalchemy] Relationship with query time evaluated primaryjoin

2016-08-04 Thread Florian Rüchel
Awesome idea, thanks for the reply! I ended up combining this approach with the callable_ argument and don't have to explicitly pass the argument now at all. This is a great approach and it is fairly simple as well. Thank you a lot. On Friday, 5 August 2016 00:24:30 UTC+10, Mike Bayer wrote:

Re: [sqlalchemy] Relationship with query time evaluated primaryjoin

2016-08-04 Thread Mike Bayer
On 08/04/2016 10:14 AM, Florian Rüchel wrote: I have a relationship that depends on a query time variable to determine the correct join. The use case is request-time localization in a web application. When running the query during a request, I want to determine the locale and only load the tran

[sqlalchemy] Relationship with query time evaluated primaryjoin

2016-08-04 Thread Florian Rüchel
I have a relationship that depends on a query time variable to determine the correct join. The use case is request-time localization in a web application. When running the query during a request, I want to determine the locale and only load the translation for the current language for a given o