Changes between Initial Version and Version 1 of Ticket #34523, comment 4


Ignore:
Timestamp:
Apr 27, 2023, 7:55:07 AM (20 months ago)
Author:
David Sanders

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #34523, comment 4

    initial v1  
    1 Ah sorry I had an environment issue , here's the exception I'm getting for 3.2.16:
    2 
    3 {{{
    4 ======================================================================
    5 ERROR: test_update_or_create (ticket_34523.tests.TransactionManagementErrorTest.test_update_or_create)
    6 ----------------------------------------------------------------------
    7 Traceback (most recent call last):
    8   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/query.py", line 581, in get_or_create
    9     return self.get(**kwargs), False
    10            ^^^^^^^^^^^^^^^^^^
    11   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/query.py", line 435, in get
    12     raise self.model.DoesNotExist(
    13 ticket_34523.tests.TransactionManagementErrorTest.TestModel.DoesNotExist: TestModel matching query does not exist.
    14 
    15 During handling of the above exception, another exception occurred:
    16 
    17 Traceback (most recent call last):
    18   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
    19     return self.cursor.execute(sql, params)
    20            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    21   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute
    22     return Database.Cursor.execute(self, query, params)
    23            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    24 sqlite3.IntegrityError: UNIQUE constraint failed: test_model_update_or_create.id
    25 
    26 The above exception was the direct cause of the following exception:
    27 
    28 Traceback (most recent call last):
    29   File "/Users/dsanders/projects/django-sample-3_2/ticket_34523/tests.py", line 42, in test_update_or_create
    30     self.TestModel.objects.update_or_create(id=1, defaults={"field": 2})
    31   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/manager.py", line 85, in manager_method
    32     return getattr(self.get_queryset(), name)(*args, **kwargs)
    33            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    34   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/query.py", line 608, in update_or_create
    35     obj, created = self.select_for_update().get_or_create(defaults, **kwargs)
    36                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    37   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/query.py", line 588, in get_or_create
    38     return self.create(**params), True
    39            ^^^^^^^^^^^^^^^^^^^^^
    40   File "/Users/dsanders/projects/django-sample-3_2/ticket_34523/tests.py", line 16, in create
    41     return super().create(**kwargs)
    42            ^^^^^^^^^^^^^^^^^^^^^^^^
    43   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/query.py", line 453, in create
    44     obj.save(force_insert=True, using=self.db)
    45   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/base.py", line 739, in save
    46     self.save_base(using=using, force_insert=force_insert,
    47   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/base.py", line 776, in save_base
    48     updated = self._save_table(
    49               ^^^^^^^^^^^^^^^^^
    50   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/base.py", line 881, in _save_table
    51     results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
    52               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    53   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/base.py", line 919, in _do_insert
    54     return manager._insert(
    55            ^^^^^^^^^^^^^^^^
    56   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/manager.py", line 85, in manager_method
    57     return getattr(self.get_queryset(), name)(*args, **kwargs)
    58            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    59   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/query.py", line 1270, in _insert
    60     return query.get_compiler(using=using).execute_sql(returning_fields)
    61            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    62   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1416, in execute_sql
    63     cursor.execute(sql, params)
    64   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/backends/utils.py", line 66, in execute
    65     return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
    66            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    67   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    68     return executor(sql, params, many, context)
    69            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    70   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in _execute
    71     with self.db.wrap_database_errors:
    72   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/utils.py", line 90, in __exit__
    73     raise dj_exc_value.with_traceback(traceback) from exc_value
    74   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
    75     return self.cursor.execute(sql, params)
    76            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    77   File "/Users/dsanders/projects/django-sample-3_2/.direnv/python-3.11.2/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute
    78     return Database.Cursor.execute(self, query, params)
    79            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    80 django.db.utils.IntegrityError: UNIQUE constraint failed: test_model_update_or_create.id
    81 
    82 ----------------------------------------------------------------------
    83 Ran 1 test in 1.192s
    84 
    85 FAILED (errors=1)
    86 }}}
Back to Top