1 | | OperationalError Traceback (most recent call last) |
2 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/django/db/backends/utils.py in _execute(self, sql, params, *ignored_wrapper_args) |
3 | | 85 else: |
4 | | ---> 86 return self.cursor.execute(sql, params) |
5 | | 87 |
6 | | |
7 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/django/db/backends/mysql/base.py in execute(self, query, args) |
8 | | 73 # args is None means no string interpolation |
9 | | ---> 74 return self.cursor.execute(query, args) |
10 | | 75 except Database.OperationalError as e: |
11 | | |
12 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/MySQLdb/cursors.py in execute(self, query, args) |
13 | | 205 assert isinstance(query, (bytes, bytearray)) |
14 | | --> 206 res = self._query(query) |
15 | | 207 return res |
16 | | |
17 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/MySQLdb/cursors.py in _query(self, q) |
18 | | 318 self._result = None |
19 | | --> 319 db.query(q) |
20 | | 320 self._do_get_result(db) |
21 | | |
22 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/MySQLdb/connections.py in query(self, query) |
23 | | 258 query = bytes(query) |
24 | | --> 259 _mysql.connection.query(self, query) |
25 | | 260 |
26 | | |
27 | | OperationalError: (2006, 'MySQL server has gone away') |
28 | | |
29 | | The above exception was the direct cause of the following exception: |
30 | | |
31 | | OperationalError Traceback (most recent call last) |
32 | | <ipython-input-367-52af1526b6a5> in <module> |
33 | | ----> 1 Price.objects.all().aggregate(Min('value')) |
34 | | |
35 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/django/db/models/query.py in aggregate(self, *args, **kwargs) |
36 | | 382 if not query.annotations[alias].contains_aggregate: |
37 | | 383 raise TypeError("%s is not an aggregate expression" % alias) |
38 | | --> 384 return query.get_aggregation(self.db, kwargs) |
39 | | 385 |
40 | | 386 def count(self): |
41 | | |
42 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/django/db/models/sql/query.py in get_aggregation(self, using, added_aggregate_names) |
43 | | 501 outer_query.select_related = False |
44 | | 502 compiler = outer_query.get_compiler(using) |
45 | | --> 503 result = compiler.execute_sql(SINGLE) |
46 | | 504 if result is None: |
47 | | 505 result = [None] * len(outer_query.annotation_select) |
48 | | |
49 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/django/db/models/sql/compiler.py in execute_sql(self, result_type, chunked_fetch, chunk_size) |
50 | | 1150 cursor = self.connection.cursor() |
51 | | 1151 try: |
52 | | -> 1152 cursor.execute(sql, params) |
53 | | 1153 except Exception: |
54 | | 1154 # Might fail for server-side cursors (e.g. connection closed) |
55 | | |
56 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/django/db/backends/utils.py in execute(self, sql, params) |
57 | | 98 def execute(self, sql, params=None): |
58 | | 99 with self.debug_sql(sql, params, use_last_executed_query=True): |
59 | | --> 100 return super().execute(sql, params) |
60 | | 101 |
61 | | 102 def executemany(self, sql, param_list): |
62 | | |
63 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/django/db/backends/utils.py in execute(self, sql, params) |
64 | | 66 |
65 | | 67 def execute(self, sql, params=None): |
66 | | ---> 68 return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) |
67 | | 69 |
68 | | 70 def executemany(self, sql, param_list): |
69 | | |
70 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/django/db/backends/utils.py in _execute_with_wrappers(self, sql, params, many, executor) |
71 | | 75 for wrapper in reversed(self.db.execute_wrappers): |
72 | | 76 executor = functools.partial(wrapper, executor) |
73 | | ---> 77 return executor(sql, params, many, context) |
74 | | 78 |
75 | | 79 def _execute(self, sql, params, *ignored_wrapper_args): |
76 | | |
77 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/django/db/backends/utils.py in _execute(self, sql, params, *ignored_wrapper_args) |
78 | | 84 return self.cursor.execute(sql) |
79 | | 85 else: |
80 | | ---> 86 return self.cursor.execute(sql, params) |
81 | | 87 |
82 | | 88 def _executemany(self, sql, param_list, *ignored_wrapper_args): |
83 | | |
84 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/django/db/utils.py in __exit__(self, exc_type, exc_value, traceback) |
85 | | 88 if dj_exc_type not in (DataError, IntegrityError): |
86 | | 89 self.wrapper.errors_occurred = True |
87 | | ---> 90 raise dj_exc_value.with_traceback(traceback) from exc_value |
88 | | 91 |
89 | | 92 def __call__(self, func): |
90 | | |
91 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/django/db/backends/utils.py in _execute(self, sql, params, *ignored_wrapper_args) |
92 | | 84 return self.cursor.execute(sql) |
93 | | 85 else: |
94 | | ---> 86 return self.cursor.execute(sql, params) |
95 | | 87 |
96 | | 88 def _executemany(self, sql, param_list, *ignored_wrapper_args): |
97 | | |
98 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/django/db/backends/mysql/base.py in execute(self, query, args) |
99 | | 72 try: |
100 | | 73 # args is None means no string interpolation |
101 | | ---> 74 return self.cursor.execute(query, args) |
102 | | 75 except Database.OperationalError as e: |
103 | | 76 # Map some error codes to IntegrityError, since they seem to be |
104 | | |
105 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/MySQLdb/cursors.py in execute(self, query, args) |
106 | | 204 |
107 | | 205 assert isinstance(query, (bytes, bytearray)) |
108 | | --> 206 res = self._query(query) |
109 | | 207 return res |
110 | | 208 |
111 | | |
112 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/MySQLdb/cursors.py in _query(self, q) |
113 | | 317 db = self._get_db() |
114 | | 318 self._result = None |
115 | | --> 319 db.query(q) |
116 | | 320 self._do_get_result(db) |
117 | | 321 self._post_get_result() |
118 | | |
119 | | ~/env38/StoreVirtual/lib/python3.8/site-packages/MySQLdb/connections.py in query(self, query) |
120 | | 257 if isinstance(query, bytearray): |
121 | | 258 query = bytes(query) |
122 | | --> 259 _mysql.connection.query(self, query) |
123 | | 260 |
124 | | 261 def _bytes_literal(self, bs): |
125 | | |
126 | | OperationalError: (2006, 'MySQL server has gone away') |