mp> I'd go for a denormalized database:
mp> (...)
tz> I'm aware of this solution, in fact I was using it. Unfortunately I
tz> had problems with deleting objects with this circular dependency, but
tz> maybe I was overlooking something (db we're using is MySQL 5).
You're right. You have to make su
On 20 Paź, 08:37, "Michael P. Jung" wrote:
> > I was unclear, but SQL should explain what I want to do - select
> > all ObjectRevision-s that are latest in Object-s that they belong to.
> > Moreover, I want to do this in with one ORM query, without resorting
> > to SQL or splitting the query to
> I was unclear, but SQL should explain what I want to do - select
> all ObjectRevision-s that are latest in Object-s that they belong to.
> Moreover, I want to do this in with one ORM query, without resorting
> to SQL or splitting the query too much.
I'd go for a denormalized database:
class Fo
2009/10/19 Tomasz Zieliński
>
> On 19 Paź, 20:21, Daniel Roseman wrote:
> >
> > You can't do this in one query with Django's ORM.
> >
> > One way of doing it in two queries might be to get use .annotate() to
> > add the max id of the related objectrevision for each revision, then
> > get all tho
On 19 Paź, 20:21, Daniel Roseman wrote:
>
> You can't do this in one query with Django's ORM.
>
> One way of doing it in two queries might be to get use .annotate() to
> add the max id of the related objectrevision for each revision, then
> get all those objectrevisions (untested):
>
> objects
On Oct 19, 5:25 pm, Tomasz Zieliński
wrote:
> On 19 Paź, 17:52, Daniel Roseman wrote:
>
> > On Oct 19, 4:17 pm, Tomasz Zieliński
>
> > It's not clear what you mean by 'all latest ObjectRevisions'. Do you
> > mean all ObjectRevisions for a particular object? If so:
> > myobject.objectrevision
On 19 Paź, 17:52, Daniel Roseman wrote:
> On Oct 19, 4:17 pm, Tomasz Zieliński
>
>
> It's not clear what you mean by 'all latest ObjectRevisions'. Do you
> mean all ObjectRevisions for a particular object? If so:
> myobject.objectrevision_set.all()
I was unclear, but SQL should explain what
On Oct 19, 4:17 pm, Tomasz Zieliński
wrote:
> Say I have Object model, which has ObjectRevision-s (ObjectRevision
> has ForeignKey to Object). I want to fetch from database all latest
> ObjectRevision-s. In SQL I can do it like this:
>
> SELECT r1.some_data
> FROM objectrevision r1
> LEFT OUTER J
Say I have Object model, which has ObjectRevision-s (ObjectRevision
has ForeignKey to Object). I want to fetch from database all latest
ObjectRevision-s. In SQL I can do it like this:
SELECT r1.some_data
FROM objectrevision r1
LEFT OUTER JOIN objectrevision nr2
ON (r1.object_id = r2.object_id AND
9 matches
Mail list logo