diff --git a/django_mongodb/base.py b/django_mongodb/base.py index 07a2866..e9a0443 100644 --- a/django_mongodb/base.py +++ b/django_mongodb/base.py @@ -71,8 +71,6 @@ class DatabaseWrapper(BaseDatabaseWrapper): "iendswith": "LIKE UPPER(%s)", } - connection: MongoClient = None - SchemaEditorClass = DatabaseSchemaEditor # Classes instantiated in __init__(). client_class = DatabaseClient diff --git a/django_mongodb/compiler.py b/django_mongodb/compiler.py index c5bbaa0..3b69758 100644 --- a/django_mongodb/compiler.py +++ b/django_mongodb/compiler.py @@ -2,7 +2,7 @@ from itertools import chain from django.db.models.sql.compiler import ( - SQLCompiler as BaseSQLCompiler, + SQLCompiler as BaseSQLCompiler, cursor_iter, ) from django.db.models.sql.compiler import ( SQLInsertCompiler as BaseSQLInsertCompiler, @@ -186,7 +186,6 @@ def results_iter( fields = [s[0] for s in self.select[0 : self.col_count]] converters = self.get_converters(fields) rows = chain.from_iterable(results) - # Temporary mapping of dict to tuple, until we move this to 'project' _row_tuples = [] cols = self.select[0 : self.col_count] for row in rows: @@ -202,18 +201,6 @@ def results_iter( yield row -def cursor_iter(cursor, sentinel, col_count, itersize): - """ - Yield blocks of rows from a cursor and ensure the cursor is closed when - done. - """ - try: - for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel): - yield rows if col_count is None else [r[:col_count] for r in rows] - finally: - cursor.close() - - class SQLDeleteCompiler(SQLCompiler): def as_operation(self, with_limits=True, with_col_aliases=False): opts = self.query.get_meta() @@ -229,8 +216,6 @@ class SQLInsertCompiler(SQLCompiler, BaseSQLInsertCompiler): compiler = "SQLInsertCompiler" def as_operation(self): - # We don't need quote_name_unless_alias() here, since these are all - # going to be column names (so we can avoid the extra overhead). opts = self.query.get_meta() fields = self.query.fields or [opts.pk]