-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INTPYTHON-348 add support for QuerySet.raw_aggregate() #183
base: main
Are you sure you want to change the base?
Conversation
For @Jibola
Actually w/test data updated, back to this:
|
One step further past primary key issue, this looks promising to me.
Because values is a dict
which maybe can be fixed in
|
@timgraham @Jibola @WaVEV Any advice for getting a "real"
Edit: never mind, misguided question. I've moved on to replacing the SQL in django tests with MQL. Thanks all. |
12a7f2c
to
51ef179
Compare
- Fix import
- Tim tips and pair w/Jib
Co-authored-by: Jib <[email protected]>
This reverts commit ac5f920.
- Subclass RawModelIterable
- Call super() on __init__s
- Fix super
- Fix __str__ on MongoRawQuerySet
- Partial fix for datefield converter bug
- Move raw_query to expected test failures
- Partial fix for datefield converter bug
- Fix MongoRawModelIterable
efdb444
to
a2008bf
Compare
|
@Jibola 🤔 ^ |
@Jibola @timgraham In case it helps, less args to
|
Right. What I meant by "peeking at the first document" is that we can't use |
E.g. something like this?
That works for me along with mongodb-forks/django@1351d2c |
I haven't examined the details, but yea, something like that. Probably it would be a cleaner abstraction to pass a Btw, in any code you copy you can can omit |
django_mongodb/query.py
Outdated
model_init_fields = [f for f in self.model._meta.fields if f.column in columns] | ||
annotation_fields = [ | ||
(column, pos) for pos, column in enumerate(columns) if column not in self.model_fields | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does self.model._meta.fields
differ from self.model_fields
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to pdb,
(Pdb) self.model._meta.fields
(<django_mongodb.fields.auto.ObjectIdAutoField: id>, <django.db.models.fields.CharField: first_name>, <django.db.models.fields.CharField: last_name>, <django.db.models.fields.DateField: dob>)
(Pdb) self.model_fields
{'_id': <django_mongodb.fields.auto.ObjectIdAutoField: id>, 'first_name': <django.db.models.fields.CharField: first_name>, 'last_name': <django.db.models.fields.CharField: last_name>, 'dob': <django.db.models.fields.DateField: dob>}
(Pdb)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored so we don't have to override this method anymore.
test changes: mongodb-forks/django#12