Skip to content

Commit ebecbd7

Browse files
committed
INTPYTHON-348 aggregate via raw_mql
1 parent d6ad9a1 commit ebecbd7

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

django_mongodb/query.py

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,52 @@ def raw_mql(self, raw_query, params=(), translations=None, using=None):
321321

322322
class MongoRawQuery(RawQuery):
323323
pass
324+
#def _execute_query(self):
325+
# connection = connections[self.using]
326+
327+
# # Adapt parameters to the database, as much as possible considering
328+
# # that the target type isn't known. See #17755.
329+
# params_type = self.params_type
330+
# adapter = connection.ops.adapt_unknown_value
331+
# if params_type is tuple:
332+
# params = tuple(adapter(val) for val in self.params)
333+
# elif params_type is dict:
334+
# params = {key: adapter(val) for key, val in self.params.items()}
335+
# elif params_type is None:
336+
# params = None
337+
# else:
338+
# raise RuntimeError("Unexpected params type: %s" % params_type)
339+
340+
# self.cursor = connection.cursor()
341+
# self.cursor.execute(self.sql, params)
342+
324343

325344
class MongoRawQuerySet(RawQuerySet):
326-
pass
345+
"""
346+
Provide an iterator which converts the results of raw SQL queries into
347+
annotated model instances.
348+
"""
349+
350+
def __init__(
351+
self,
352+
raw_query,
353+
model=None,
354+
query=None,
355+
params=(),
356+
translations=None,
357+
using=None,
358+
hints=None,
359+
):
360+
pass
361+
# self.raw_query = raw_query
362+
# self.model = model
363+
# self._db = using
364+
# self._hints = hints or {}
365+
# self.query = query or sql.RawQuery(sql=raw_query, using=self.db, params=params)
366+
# self.params = params
367+
# self.translations = translations or {}
368+
# self._result_cache = None
369+
# self._prefetch_related_lookups = ()
370+
# self._prefetch_done = False
371+
372+

0 commit comments

Comments
 (0)