noodles775 | lukasz: reading https://docs.djangoproject.com/en/dev/topics/db/queries/#spanning-multi-valued-relationships | 11:03 |
---|---|---|
noodles775 | What would you expect Blog.objects.exclude(entry__headline__contains='Lennon', entry__pub_date__year=2008) to do, and why? | 11:03 |
lukasz | noodles775: exclude blog objects which have associated entry (headline~='Lenon' & year(pub_date)=2008) | 11:08 |
noodles775 | lukasz: that's what I would expect too, but this django test fails http://paste.ubuntu.com/754721/ | 11:09 |
lukasz | noodles775: as ',' in exclude is (should be) translated to AND | 11:09 |
noodles775 | with | 11:09 |
noodles775 | http://paste.ubuntu.com/754723/ | 11:10 |
noodles775 | If you agree, I'll submit a django ticket. | 11:11 |
lukasz | noodles775: that's the last assert in test? | 11:13 |
noodles775 | lukasz: yep - it's the same problem that danny was seeing in his branch when trying my suggested query. | 11:14 |
lukasz | noodles775: I think it works as expected, as you have: SELECT ... WHERE NOT ((article.headline = 'Article_ with underscore) AND (article.pub_date < '2006-01-01')) | 11:16 |
noodles775 | lukasz: the SQL is doing that, yes, but that wasn't what you expected above was it? (or what did I miss?) | 11:17 |
lukasz | or am I confused :/ | 11:17 |
lukasz | noodles775: but then, how would you write SQL for the expected behaviour? | 11:18 |
noodles775 | lukasz: Not sure I would, but I wouldn't advertise it as doing the expected behaviour. | 11:19 |
lukasz | noodles775: maybe submit a ticket and see what django devs think about it | 11:23 |
noodles775 | lukasz: yeah, doing so now. | 11:23 |
lukasz | although changing that behaviour would be a big, incompatible change | 11:24 |
noodles775 | updating the documentation would work. | 11:24 |
lukasz | ah, right | 11:24 |
* noodles775 checks the query for the filter too | 11:25 | |
lukasz | .exclude(a, b) == .filter(Q(~Q(a) | ~Q(b))) | 11:25 |
noodles775 | This is the exclude query (formatted): http://paste.ubuntu.com/754738/ | 11:26 |
lukasz | LIMIT 21? | 11:28 |
noodles775 | No idea whyh the limit is 21 | 11:28 |
noodles775 | Filter and exclude together: http://paste.ubuntu.com/754742/ | 11:30 |
lukasz | ok, that's interesting | 11:35 |
noodles775 | Yeah, the exclude is "Show me all authors who have not published an article with underscore and have not published an article before 2006", which is [], but not what was intended, I think. | 11:37 |
noodles775 | lukasz: I botched the formatting, but here's the bug fwiw: https://code.djangoproject.com/ticket/17315 | 11:57 |
ubot2 | Django bug 17315 in Database layer (models, ORM) ".exclude(a, b) does not operate on a single related record" [Normal,New] | 11:57 |
jml | https://code.launchpad.net/~jml/pkgme-service/end-to-end-pkgme/+merge/83624 finally ready for review | 12:21 |
jml | Can I get a review of that branch please? | 16:24 |
jml | https://code.launchpad.net/~jml/pkgme-service/end-to-end-pkgme/+merge/83624 | 16:24 |
noodles775 | jml: if it's not done when you start tomorrow, ping me and I'd be happy to go through it with you. | 16:27 |
jml | noodles775: thanks. | 16:43 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!