You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.
For the first Player.objects.as_of()-query, we get the player object; for the second, we get no results.
My understanding is that VersionedForeignKey.get_extra_restriction() adds WHERE-clauses as appropriate wrt. version_start_date and version_end_date for the active querytime. (Or for the "current" version if there is no active querytime.)
With the JOIN constructed by Django, we get a join on primary key, which would match only the newest version, and if the newest version is not the appropriate one for the querytime the WHERE-clause discards it, and we get no result where one was expected.
Unfortunately, I don't have any good solution to this; modifying logic that sets up joins so that as_of()-queries might join on identity instead of id (as the existing get_extra_restriction() should ensure that we get only one) where appropriate, without breaking table creation, without breaking the currently working queries through versioned many-to-many relations, would seem to require overriding a lot of methods on Query with only minor changes... That might work, though it sounds rather messy... Hopefully, you can come up with a better idea?
The text was updated successfully, but these errors were encountered:
thanks for your contribution. This is just to inform you that I've taken up your test case and I'm currently working on a solution to this issue. As you've mentioned, there are quite a couple of potential conflicts with existing tests.
I'll keep you updated as soon as I've got something usable.
-Manuel
@arild-haugstad I've written a fix in PR #50 for the problem you reported. I hope this enables you in proceeding to use CleanerVersion!
Thanks for contributing,
-Manuel
This test should illustrate the issue:
For the first
Player.objects.as_of()
-query, we get the player object; for the second, we get no results.My understanding is that
VersionedForeignKey.get_extra_restriction()
addsWHERE
-clauses as appropriate wrt.version_start_date
andversion_end_date
for the activequerytime
. (Or for the "current" version if there is no activequerytime
.)With the
JOIN
constructed by Django, we get a join on primary key, which would match only the newest version, and if the newest version is not the appropriate one for thequerytime
theWHERE
-clause discards it, and we get no result where one was expected.Unfortunately, I don't have any good solution to this; modifying logic that sets up joins so that
as_of()
-queries might join onidentity
instead ofid
(as the existingget_extra_restriction()
should ensure that we get only one) where appropriate, without breaking table creation, without breaking the currently working queries through versioned many-to-many relations, would seem to require overriding a lot of methods onQuery
with only minor changes... That might work, though it sounds rather messy... Hopefully, you can come up with a better idea?The text was updated successfully, but these errors were encountered: