Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.73 KB | None | 0 0
  1. In [11]: for sp in SegmentProperty.objects.filter(company=c0):
  2.     ...:     sp.id=None
  3.     ...:     sp.dictionary=None
  4.     ...:     sp.company=c
  5.     ...:     sp.group=None
  6.     ...:     sp.save()
  7.     ...:
  8.     ...:
  9. ---------------------------------------------------------------------------
  10. InvalidParameterValue                     Traceback (most recent call last)
  11. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/utils.py in _execute(self, sql, params, *ignored_wrapper_args)
  12.      83             else:
  13. ---> 84                 return self.cursor.execute(sql, params)
  14.      85
  15.  
  16. InvalidParameterValue: cannot extract elements from an object
  17.  
  18.  
  19. The above exception was the direct cause of the following exception:
  20.  
  21. DataError                                 Traceback (most recent call last)
  22. <ipython-input-11-622f61182603> in <module>
  23.       4     sp.company=c
  24.       5     sp.group=None
  25. ----> 6     sp.save()
  26.       7
  27.       8
  28.  
  29. ~/Projects/qa/src/server/segments/models.py in save(self, *args, **kwargs)
  30.     159         super().save(*args, **kwargs)
  31.     160         transaction.on_commit(
  32. --> 161             lambda: self.set_cache()
  33.     162         )
  34.     163
  35.  
  36. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/transaction.py in on_commit(func, using)
  37.     126     If the current transaction is rolled back, `func` will not be called.
  38.     127     """
  39. --> 128     get_connection(using).on_commit(func)
  40.    129
  41.    130
  42.  
  43. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/base/base.py in on_commit(self, func)
  44.    626             # No transaction in progress and in autocommit mode; execute
  45.    627             # immediately.
  46. --> 628             func()
  47.    629
  48.    630     def run_and_clear_commit_hooks(self):
  49.  
  50. ~/Projects/qa/src/server/segments/models.py in <lambda>()
  51.    159         super().save(*args, **kwargs)
  52.    160         transaction.on_commit(
  53. --> 161             lambda: self.set_cache()
  54.    162         )
  55.    163
  56.  
  57. ~/Projects/qa/src/server/common/models.py in set_cache(self)
  58.     66     def set_cache(self):
  59.     67         if self.cache.is_cache:
  60. ---> 68             self.cache.set_model(self)
  61.     69
  62.     70
  63.  
  64. ~/Projects/qa/src/server/segments/cache.py in set_model(self, instance)
  65.    112
  66.    113     def set_model(self, instance):
  67. --> 114         data = instance.serialize()
  68.    115         if self.is_cache:
  69.    116             self.set_by_id(str(instance.id), data)
  70.  
  71. ~/Projects/qa/src/server/segments/models.py in serialize(self)
  72.    143             'remote_model': str(self.remote_model_id) if self.remote_model_id else None,
  73.    144             'operators': self.operators,
  74. --> 145             'property_values': self.count_values(),
  75.    146             'limits': self.limits,
  76.    147             'is_editable': self.is_editable,
  77.  
  78. ~/Projects/qa/src/server/segments/models.py in count_values(self)
  79.    270
  80.    271         from segments.utils import get_enum_data
  81. --> 272         enum_data = get_enum_data(self)
  82.    273         return [
  83.    274             dict(ext_id=ext_id, name=name)
  84.  
  85. ~/Projects/qa/src/server/segments/utils.py in get_enum_data(enum_property)
  86.    154             'ext_id': enum_property.get_jsonb_select(),
  87.    155             'name': name_property.get_jsonb_select(),
  88. --> 156         }).values_list('ext_id', 'name').distinct()
  89.    157         if ext_id
  90.    158     }
  91.  
  92. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/models/query.py in __iter__(self)
  93.    272                - Responsible for turning the rows into model objects.
  94.    273         """
  95. --> 274         self._fetch_all()
  96.     275         return iter(self._result_cache)
  97.     276
  98.  
  99. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/models/query.py in _fetch_all(self)
  100.    1240     def _fetch_all(self):
  101.    1241         if self._result_cache is None:
  102. -> 1242             self._result_cache = list(self._iterable_class(self))
  103.    1243         if self._prefetch_related_lookups and not self._prefetch_done:
  104.    1244             self._prefetch_related_objects()
  105.  
  106. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/models/query.py in __iter__(self)
  107.     142                     compiler.results_iter(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  108.     143                 )
  109. --> 144         return compiler.results_iter(tuple_expected=True, chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  110.     145
  111.     146
  112.  
  113. ~/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)
  114.    1050         """Return an iterator over the results from executing this query."""
  115.    1051         if results is None:
  116. -> 1052             results = self.execute_sql(MULTI, chunked_fetch=chunked_fetch, chunk_size=chunk_size)
  117.    1053         fields = [s[0] for s in self.select[0:self.col_count]]
  118.    1054         converters = self.get_converters(fields)
  119.  
  120. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/models/sql/compiler.py in execute_sql(self, result_type, chunked_fetch, chunk_size)
  121.    1098             cursor = self.connection.cursor()
  122.    1099         try:
  123. -> 1100             cursor.execute(sql, params)
  124.    1101         except Exception:
  125.    1102             # Might fail for server-side cursors (e.g. connection closed)
  126.  
  127. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/utils.py in execute(self, sql, params)
  128.      97         start = time()
  129.      98         try:
  130. ---> 99             return super().execute(sql, params)
  131.     100         finally:
  132.     101             stop = time()
  133.  
  134. ~/Projects/qa/env/lib/python3.7/site-packages/raven/contrib/django/client.py in execute(self, sql, params)
  135.     125         start = time.time()
  136.     126         try:
  137. --> 127             return real_execute(self, sql, params)
  138.     128         finally:
  139.     129             record_sql(self.db.vendor, getattr(self.db, 'alias', None),
  140.  
  141. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/utils.py in execute(self, sql, params)
  142.      65
  143.      66     def execute(self, sql, params=None):
  144. ---> 67         return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  145.      68
  146.      69     def executemany(self, sql, param_list):
  147.  
  148. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/utils.py in _execute_with_wrappers(self, sql, params, many, executor)
  149.      74         for wrapper in reversed(self.db.execute_wrappers):
  150.      75             executor = functools.partial(wrapper, executor)
  151. ---> 76         return executor(sql, params, many, context)
  152.      77
  153.      78     def _execute(self, sql, params, *ignored_wrapper_args):
  154.  
  155. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/utils.py in _execute(self, sql, params, *ignored_wrapper_args)
  156.      82                 return self.cursor.execute(sql)
  157.      83             else:
  158. ---> 84                 return self.cursor.execute(sql, params)
  159.      85
  160.      86     def _executemany(self, sql, param_list, *ignored_wrapper_args):
  161.  
  162. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/utils.py in __exit__(self, exc_type, exc_value, traceback)
  163.      87                 if dj_exc_type not in (DataError, IntegrityError):
  164.      88                     self.wrapper.errors_occurred = True
  165. ---> 89                 raise dj_exc_value.with_traceback(traceback) from exc_value
  166.      90
  167.      91     def __call__(self, func):
  168.  
  169. ~/Projects/qa/env/lib/python3.7/site-packages/django/db/backends/utils.py in _execute(self, sql, params, *ignored_wrapper_args)
  170.      82                 return self.cursor.execute(sql)
  171.      83             else:
  172. ---> 84                 return self.cursor.execute(sql, params)
  173.      85
  174.      86     def _executemany(self, sql, param_list, *ignored_wrapper_args):
  175.  
  176. DataError: cannot extract elements from an object
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement