Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In [11]: for sp in SegmentProperty.objects.filter(company=c0):
- ...: sp.id=None
- ...: sp.dictionary=None
- ...: sp.company=c
- ...: sp.group=None
- ...: sp.save()
- ...:
- ...:
- ---------------------------------------------------------------------------
- InvalidParameterValue Traceback (most recent call last)
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/utils.py in _execute(self, sql, params, *ignored_wrapper_args)
- 83 else:
- ---> 84 return self.cursor.execute(sql, params)
- 85
- InvalidParameterValue: cannot extract elements from an object
- The above exception was the direct cause of the following exception:
- DataError Traceback (most recent call last)
- <ipython-input-11-622f61182603> in <module>
- 4 sp.company=c
- 5 sp.group=None
- ----> 6 sp.save()
- 7
- 8
- ~/Projects/qa/src/server/segments/models.py in save(self, *args, **kwargs)
- 159 super().save(*args, **kwargs)
- 160 transaction.on_commit(
- --> 161 lambda: self.set_cache()
- 162 )
- 163
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/transaction.py in on_commit(func, using)
- 126 If the current transaction is rolled back, `func` will not be called.
- 127 """
- --> 128 get_connection(using).on_commit(func)
- 129
- 130
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/base/base.py in on_commit(self, func)
- 626 # No transaction in progress and in autocommit mode; execute
- 627 # immediately.
- --> 628 func()
- 629
- 630 def run_and_clear_commit_hooks(self):
- ~/Projects/qa/src/server/segments/models.py in <lambda>()
- 159 super().save(*args, **kwargs)
- 160 transaction.on_commit(
- --> 161 lambda: self.set_cache()
- 162 )
- 163
- ~/Projects/qa/src/server/common/models.py in set_cache(self)
- 66 def set_cache(self):
- 67 if self.cache.is_cache:
- ---> 68 self.cache.set_model(self)
- 69
- 70
- ~/Projects/qa/src/server/segments/cache.py in set_model(self, instance)
- 112
- 113 def set_model(self, instance):
- --> 114 data = instance.serialize()
- 115 if self.is_cache:
- 116 self.set_by_id(str(instance.id), data)
- ~/Projects/qa/src/server/segments/models.py in serialize(self)
- 143 'remote_model': str(self.remote_model_id) if self.remote_model_id else None,
- 144 'operators': self.operators,
- --> 145 'property_values': self.count_values(),
- 146 'limits': self.limits,
- 147 'is_editable': self.is_editable,
- ~/Projects/qa/src/server/segments/models.py in count_values(self)
- 270
- 271 from segments.utils import get_enum_data
- --> 272 enum_data = get_enum_data(self)
- 273 return [
- 274 dict(ext_id=ext_id, name=name)
- ~/Projects/qa/src/server/segments/utils.py in get_enum_data(enum_property)
- 154 'ext_id': enum_property.get_jsonb_select(),
- 155 'name': name_property.get_jsonb_select(),
- --> 156 }).values_list('ext_id', 'name').distinct()
- 157 if ext_id
- 158 }
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/models/query.py in __iter__(self)
- 272 - Responsible for turning the rows into model objects.
- 273 """
- --> 274 self._fetch_all()
- 275 return iter(self._result_cache)
- 276
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/models/query.py in _fetch_all(self)
- 1240 def _fetch_all(self):
- 1241 if self._result_cache is None:
- -> 1242 self._result_cache = list(self._iterable_class(self))
- 1243 if self._prefetch_related_lookups and not self._prefetch_done:
- 1244 self._prefetch_related_objects()
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/models/query.py in __iter__(self)
- 142 compiler.results_iter(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
- 143 )
- --> 144 return compiler.results_iter(tuple_expected=True, chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
- 145
- 146
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/models/sql/compiler.py in results_iter(self, results, tuple_expected, chunked_fetch, chunk_size)
- 1050 """Return an iterator over the results from executing this query."""
- 1051 if results is None:
- -> 1052 results = self.execute_sql(MULTI, chunked_fetch=chunked_fetch, chunk_size=chunk_size)
- 1053 fields = [s[0] for s in self.select[0:self.col_count]]
- 1054 converters = self.get_converters(fields)
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/models/sql/compiler.py in execute_sql(self, result_type, chunked_fetch, chunk_size)
- 1098 cursor = self.connection.cursor()
- 1099 try:
- -> 1100 cursor.execute(sql, params)
- 1101 except Exception:
- 1102 # Might fail for server-side cursors (e.g. connection closed)
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/utils.py in execute(self, sql, params)
- 97 start = time()
- 98 try:
- ---> 99 return super().execute(sql, params)
- 100 finally:
- 101 stop = time()
- ~/Projects/qa/env/lib/python3.7/site-packages/raven/contrib/django/client.py in execute(self, sql, params)
- 125 start = time.time()
- 126 try:
- --> 127 return real_execute(self, sql, params)
- 128 finally:
- 129 record_sql(self.db.vendor, getattr(self.db, 'alias', None),
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/utils.py in execute(self, sql, params)
- 65
- 66 def execute(self, sql, params=None):
- ---> 67 return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
- 68
- 69 def executemany(self, sql, param_list):
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/utils.py in _execute_with_wrappers(self, sql, params, many, executor)
- 74 for wrapper in reversed(self.db.execute_wrappers):
- 75 executor = functools.partial(wrapper, executor)
- ---> 76 return executor(sql, params, many, context)
- 77
- 78 def _execute(self, sql, params, *ignored_wrapper_args):
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/utils.py in _execute(self, sql, params, *ignored_wrapper_args)
- 82 return self.cursor.execute(sql)
- 83 else:
- ---> 84 return self.cursor.execute(sql, params)
- 85
- 86 def _executemany(self, sql, param_list, *ignored_wrapper_args):
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/utils.py in __exit__(self, exc_type, exc_value, traceback)
- 87 if dj_exc_type not in (DataError, IntegrityError):
- 88 self.wrapper.errors_occurred = True
- ---> 89 raise dj_exc_value.with_traceback(traceback) from exc_value
- 90
- 91 def __call__(self, func):
- ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/utils.py in _execute(self, sql, params, *ignored_wrapper_args)
- 82 return self.cursor.execute(sql)
- 83 else:
- ---> 84 return self.cursor.execute(sql, params)
- 85
- 86 def _executemany(self, sql, param_list, *ignored_wrapper_args):
- DataError: cannot extract elements from an object
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement