Problem deleting rows #220

Closed
opened 2024-02-08 09:11:16 +00:00 by kae · 0 comments
Owner

Deleting rows at end of playlist left three blank rows with "-1" in first column. Also had exception on quitting:

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
    1852  def _exec_single_context(
    1853      self,
    1854      dialect: Dialect,
    1855      context: ExecutionContext,
    1856      statement: Union[str, Compiled],
    1857      parameters: Optional[_AnyMultiExecuteParams],
    1858  ) -> CursorResult[Any]:
 (...)
    1965                      ):
    1966                          evt_handled = True
    1967                          break
    1968              if not evt_handled:
--> 1969                  self.dialect.do_execute(
    1970                      cursor, str_statement, effective_parameters, context
    ..................................................
     self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50>
     dialect = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje
                ct at 0x7f142196b3d0>
     context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys
                qldb object at 0x7f136b619c10>
     statement = <sqlalchemy.dialects.mysql.mysqldb.MySQLCompiler_mysqldb obj
                  ect at 0x7f136b61bdd0>
     parameters = [(0, 133, ), ]
     evt_handled = False
     self.dialect.do_execute = <method 'DefaultDialect.do_execute' of <sqlalchemy.dialects.
                                mysql.mysqldb.MySQLDialect_mysqldb object at 0x7f142196b3d0>
                                 default.py:921>
     cursor = <MySQLdb.cursors.Cursor object at 0x7f136b61b390>
     str_statement = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s'
     effective_parameters = (0, 133, )
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
    921  def do_execute(self, cursor, statement, parameters, context=None):
--> 922      cursor.execute(statement, parameters)
    ..................................................
     self = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje
             ct at 0x7f142196b3d0>
     cursor = <MySQLdb.cursors.Cursor object at 0x7f136b61b390>
     statement = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s'
     parameters = (0, 133, )
     context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys
                qldb object at 0x7f136b619c10>
     cursor.execute = <method 'BaseCursor.execute' of <MySQLdb.cursors.Cursor obje
                       ct at 0x7f136b61b390> cursors.py:162>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute
    162  def execute(self, query, args=None):
 (...)
    175  
    176      mogrified_query = self._mogrify(query, args)
    177  
    178      assert isinstance(mogrified_query, (bytes, bytearray))
--> 179      res = self._query(mogrified_query)
    180      return res
    ..................................................
     self = <MySQLdb.cursors.Cursor object at 0x7f136b61b390>
     query = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s'
     args = (0, 133, )
     mogrified_query = b'UPDATE playlists SET tab=0 WHERE playlists.id = 133'
     self._mogrify = <method 'BaseCursor._mogrify' of <MySQLdb.cursors.Cursor obj
                      ect at 0x7f136b61b390> cursors.py:182>
     self._query = <method 'BaseCursor._query' of <MySQLdb.cursors.Cursor objec
                    t at 0x7f136b61b390> cursors.py:325>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query
    325  def _query(self, q):
    326      db = self._get_db()
    327      self._result = None
    328      self.rowcount = None
    329      self.lastrowid = None
--> 330      db.query(q)
    331      self._do_get_result(db)
    ..................................................
     self = <MySQLdb.cursors.Cursor object at 0x7f136b61b390>
     q = b'UPDATE playlists SET tab=0 WHERE playlists.id = 133'
     db = <_mysql.connection open to 'localhost' at 0x27f46f0>
     self._get_db = <method 'BaseCursor._get_db' of <MySQLdb.cursors.Cursor obje
                     ct at 0x7f136b61b390> cursors.py:156>
     self._result = None
     self.rowcount = None
     self.lastrowid = None
     db.query = <method 'Connection.query' of <_mysql.connection open to 'lo
                 calhost' at 0x27f46f0> connections.py:251>
     self._do_get_result = <method 'BaseCursor._do_get_result' of <MySQLdb.cursors.Curs
                            or object at 0x7f136b61b390> cursors.py:135>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/connections.py", line 255, in query
    251  def query(self, query):
    252      # Since _mysql releases GIL while querying, we need immutable buffer.
    253      if isinstance(query, bytearray):
    254          query = bytes(query)
--> 255      _mysql.connection.query(self, query)
    ..................................................
     query = b'UPDATE playlists SET tab=0 WHERE playlists.id = 133'
     self = <_mysql.connection open to 'localhost' at 0x27f46f0>
    ..................................................

---- (full traceback above) ----
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
    self.dialect.do_execute(
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
    cursor.execute(statement, parameters)
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute
    res = self._query(mogrified_query)
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query
    db.query(q)
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/connections.py", line 255, in query
    _mysql.connection.query(self, query)

IntegrityError: (1062, "Duplicate entry '0' for key 'tab'")

The above exception was the direct cause of the following exception:

File "/home/kae/mm/app/musicmuster.py", line 469, in closeEvent
    419  def closeEvent(self, event: Optional[QCloseEvent]) -> None:
 (...)
    465                  playlist_id = self.tabPlaylist.widget(idx).playlist_id
    466                  playlist = session.get(Playlists, playlist_id)
    467                  if playlist:
    468                      playlist.tab = idx
--> 469                      session.flush()
    470  
    ..................................................
     self = <__main__.Window object at 0x7f1420f163b0>
     event = <PyQt6.QtGui.QCloseEvent object at 0x7f13ec7c2320>
     playlist_id = 133
     idx = 0
     playlist = # error calling repr and str
     session.get = <method 'scoped_session.get' of <sqlalchemy.orm.scoping.scop
                    ed_session object at 0x7f13ec506c90> scoping.py:943>
     playlist.tab = # PendingRollbackError
          playlist = # error calling repr and str
     session.flush = <method 'scoped_session.flush' of <sqlalchemy.orm.scoping.sc
                      oped_session object at 0x7f13ec506c90> scoping.py:912>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/scoping.py", line 941, in flush
    912  def flush(self, objects: Optional[Sequence[Any]] = None) -> None:
 (...)
    937  
    938  
    939      """  # noqa: E501
    940  
--> 941      return self._proxied.flush(objects=objects)
    ..................................................
     objects = None
     self._proxied.flush = <method 'Session.flush' of <sqlalchemy.orm.session.Session o
                            bject at 0x7f13ec506710> session.py:4282>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4312, in flush
    4282  def flush(self, objects: Optional[Sequence[Any]] = None) -> None:
 (...)
    4308      if self._is_clean():
    4309          return
    4310      try:
    4311          self._flushing = True
--> 4312          self._flush(objects)
    4313      finally:
    ..................................................
     self = <sqlalchemy.orm.session.Session object at 0x7f13ec506710>
     objects = None
     self._is_clean = <method 'Session._is_clean' of <sqlalchemy.orm.session.Sessi
                       on object at 0x7f13ec506710> session.py:4324>
     self._flushing = False
     self._flush = <method 'Session._flush' of <sqlalchemy.orm.session.Session 
                    object at 0x7f13ec506710> session.py:4331>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4447, in _flush
    4331  def _flush(self, objects: Optional[Sequence[object]] = None) -> None:
 (...)
    4443  
    4444          transaction.commit()
    4445  
    4446      except:
--> 4447          with util.safe_reraise():
    4448              transaction.rollback(_capture_exception=True)
    ..................................................
     self = <sqlalchemy.orm.session.Session object at 0x7f13ec506710>
     objects = None
     transaction.commit = <method 'SessionTransaction.commit' of <sqlalchemy.orm.sessi
                           on.SessionTransaction object at 0x7f13ec6bbed0> <string>:1>
     transaction.rollback = <method 'SessionTransaction.rollback' of <sqlalchemy.orm.ses
                             sion.SessionTransaction object at 0x7f13ec6bbed0> <string>:1
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    134  def __exit__(
    135      self,
    136      type_: Optional[Type[BaseException]],
    137      value: Optional[BaseException],
    138      traceback: Optional[types.TracebackType],
    139  ) -> NoReturn:
 (...)
    142      if type_ is None:
    143          exc_type, exc_value, exc_tb = self._exc_info
    144          assert exc_value is not None
    145          self._exc_info = None  # remove potential circular references
--> 146          raise exc_value.with_traceback(exc_tb)
    147      else:
    ..................................................
     self = <sqlalchemy.util.langhelpers.safe_reraise object at 0x7f13ec
             7fb4f0>
     type_ = None
     value = None
     traceback = None
     exc_value = IntegrityError('(MySQLdb.IntegrityError) (1062, "Duplicate e
                  ntry \'0\' for key \'tab\'")')
     exc_tb = <traceback object at 0x7f13ec550a40>
     self._exc_info = None
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4408, in _flush
    4331  def _flush(self, objects: Optional[Sequence[object]] = None) -> None:
 (...)
    4404      flush_context.transaction = transaction = self._autobegin_t()._begin()
    4405      try:
    4406          self._warn_on_events = True
    4407          try:
--> 4408              flush_context.execute()
    4409          finally:
    ..................................................
     self = <sqlalchemy.orm.session.Session object at 0x7f13ec506710>
     objects = None
     flush_context.transaction = <sqlalchemy.orm.session.SessionTransaction object at 0x7f13e
                                  c6bbed0>
     transaction = <sqlalchemy.orm.session.SessionTransaction object at 0x7f13e
                    c6bbed0>
     self._autobegin_t = <method 'Session._autobegin_t' of <sqlalchemy.orm.session.Se
                          ssion object at 0x7f13ec506710> session.py:1813>
     self._warn_on_events = False
     flush_context.execute = <method 'UOWTransaction.execute' of <sqlalchemy.orm.unitofwo
                              rk.UOWTransaction object at 0x7f136b616990> unitofwork.py:44
                              1>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute
    441  def execute(self) -> None:
 (...)
    462                  n = set_.pop()
    463                  n.execute_aggregate(self, set_)
    464      else:
    465          for rec in topological.sort(self.dependencies, postsort_actions):
--> 466              rec.execute(self)
    ..................................................
     self = <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7f136b
             616990>
     rec = SaveUpdateAll(Mapper[Playlists(playlists)])
     topological.sort = <function 'sort' topological.py:58>
     self.dependencies = {(SaveUpdateAll(Mapper[Playlists(playlists)]), DeleteAll(Map
                          per[Playlists(playlists)]), ), }
     postsort_actions = [DeleteAll(Mapper[Playlists(playlists)]), SaveUpdateAll(Mapp
                         er[Playlists(playlists)]), ]
     rec.execute = <method 'SaveUpdateAll.execute' of SaveUpdateAll(Mapper[Play
                    lists(playlists)]) unitofwork.py:640>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute
    640  @util.preload_module("sqlalchemy.orm.persistence")
    641  def execute(self, uow):
--> 642      util.preloaded.orm_persistence.save_obj(
    643          self.mapper,
    ..................................................
     util.preload_module = <method '_ModuleRegistry.preload_module' of <sqlalchemy.util
                            .preloaded._ModuleRegistry object at 0x7f142718fdd0> preload
                            ed.py:118>
     self = SaveUpdateAll(Mapper[Playlists(playlists)])
     uow = <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7f136b
            616990>
     util.preloaded.orm_persistence.save_obj = <function 'save_obj' persistence.py:40>
     self.mapper = <Mapper at 0x7f14218b54d0; Playlists>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 85, in save_obj
    40   def save_obj(base_mapper, states, uowtransaction, single=False):
 (...)
    81           update = _collect_update_commands(
    82               uowtransaction, table, states_to_update
    83           )
    84   
--> 85           _emit_update_statements(
    86               base_mapper,
    ..................................................
     base_mapper = <Mapper at 0x7f14218b54d0; Playlists>
     states = <generator object UOWTransaction.states_for_mapper_hierarchy
                at 0x7f1415006140>
     uowtransaction = <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7f136b
                       616990>
     single = False
     update = <generator object _collect_update_commands at 0x7f14216fbc40
     table = Table('playlists', MetaData(), Column('id', Integer(), table
              =<playlists>, primary_key=True, nullable=False), Column('nam
              e', String(length=32), table=<playlists>, nullable=False), C
              olumn('last_used', DateTime(), table=<playlists>), Column('t
              ab', Integer(), table=<playlists>), Column('open', Boolean()
              , table=<playlists>, nullable=False, default=ScalarElementCo
              lumnDefault(False)), Column('is_template', Boolean(), table=
              <playlists>, nullable=False, default=ScalarElementColumnDefa
              ult(False)), Column(...
     states_to_update = [(<sqlalchemy.orm.state.InstanceState object at 0x7f13ec7e05
                         30>, {...}, <Mapper at 0x7f14218b54d0; Playlists>, <sqlalche
                         my.engine.base.Connection object at 0x7f136b617f50>, None, )
                         , ]
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 909, in _emit_update_statements
    725  def _emit_update_statements(
    726      base_mapper,
    727      uowtransaction,
    728      mapper,
    729      table,
    730      update,
    731      *,
    732      bookkeeping=True,
    733      use_orm_update_stmt=None,
    734      enable_check_rowcount=True,
    735  ):
 (...)
    905                      assert_multirow
    906                      or (assert_singlerow and len(multiparams) == 1)
    907                  )
    908  
--> 909                  c = connection.execute(
    910                      statement, multiparams, execution_options=execution_options
    ..................................................
     base_mapper = <Mapper at 0x7f14218b54d0; Playlists>
     uowtransaction = <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7f136b
                       616990>
     mapper = <Mapper at 0x7f14218b54d0; Playlists>
     table = Table('playlists', MetaData(), Column('id', Integer(), table
              =<playlists>, primary_key=True, nullable=False), Column('nam
              e', String(length=32), table=<playlists>, nullable=False), C
              olumn('last_used', DateTime(), table=<playlists>), Column('t
              ab', Integer(), table=<playlists>), Column('open', Boolean()
              , table=<playlists>, nullable=False, default=ScalarElementCo
              lumnDefault(False)), Column('is_template', Boolean(), table=
              <playlists>, nullable=False, default=ScalarElementColumnDefa
              ult(False)), Column(...
     update = <generator object _collect_update_commands at 0x7f14216fbc40
     bookkeeping = True
     use_orm_update_stmt = None
     enable_check_rowcount = True
     assert_multirow = True
     assert_singlerow = True
     multiparams = [
                    {'tab': 0,
                     'playlists_id': 133}, ]
     connection.execute = <method 'Connection.execute' of <sqlalchemy.engine.base.Conn
                           ection object at 0x7f136b617f50> base.py:1372>
     statement = <sqlalchemy.sql.dml.Update object at 0x7f136b165010>
     execution_options = {'compiled_cache': <sqlalchemy.util._collections.LRUCache ob
                          ject at 0x7f13ec20c590>}
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
    1372  def execute(
    1373      self,
    1374      statement: Executable,
    1375      parameters: Optional[_CoreAnyExecuteParams] = None,
    1376      *,
    1377      execution_options: Optional[CoreExecuteOptionsParameter] = None,
    1378  ) -> CursorResult[Any]:
 (...)
    1412          meth = statement._execute_on_connection
    1413      except AttributeError as err:
    1414          raise exc.ObjectNotExecutableError(statement) from err
    1415      else:
--> 1416          return meth(
    1417              self,
    ..................................................
     self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50>
     statement = <sqlalchemy.sql.dml.Update object at 0x7f136b165010>
     parameters = [
                   {'tab': 0,
                    'playlists_id': 133}, ]
     execution_options = {'compiled_cache': <sqlalchemy.util._collections.LRUCache ob
                          ject at 0x7f13ec20c590>}
     meth = <method 'ClauseElement._execute_on_connection' of UPDATE pla
             ylists SET id=:id, name=:name, last_used=:last_used, tab=:ta
             b, open=:open, is_template=:is_template, deleted=:deleted WH
             ERE playlists.id = :playlists_id elements.py:507>
     statement._execute_on_connection = <method 'ClauseElement._execute_on_connection' of UPDATE pla
                                         ylists SET id=:id, name=:name, last_used=:last_used, tab=:ta
                                         b, open=:open, is_template=:is_template, deleted=:deleted WH
                                         ERE playlists.id = :playlists_id elements.py:507>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection
    507  def _execute_on_connection(
    508      self,
    509      connection: Connection,
    510      distilled_params: _CoreMultiExecuteParams,
    511      execution_options: CoreExecuteOptionsParameter,
    512  ) -> Result[Any]:
    513      if self.supports_execution:
    514          if TYPE_CHECKING:
    515              assert isinstance(self, Executable)
--> 516          return connection._execute_clauseelement(
    517              self, distilled_params, execution_options
    ..................................................
     self = <sqlalchemy.sql.dml.Update object at 0x7f136b165010>
     connection = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50>
     distilled_params = [
                         {'tab': 0,
                          'playlists_id': 133}, ]
     execution_options = {'compiled_cache': <sqlalchemy.util._collections.LRUCache ob
                          ject at 0x7f13ec20c590>}
     self.supports_execution = True
     TYPE_CHECKING = False
     connection._execute_clauseelement = <method 'Connection._execute_clauseelement' of <sqlalchemy.e
                                          ngine.base.Connection object at 0x7f136b617f50> base.py:1589
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement
    1589  def _execute_clauseelement(
    1590      self,
    1591      elem: Executable,
    1592      distilled_parameters: _CoreMultiExecuteParams,
    1593      execution_options: CoreExecuteOptionsParameter,
    1594  ) -> CursorResult[Any]:
 (...)
    1635          for_executemany=for_executemany,
    1636          schema_translate_map=schema_translate_map,
    1637          linting=self.dialect.compiler_linting | compiler.WARN_LINTING,
    1638      )
--> 1639      ret = self._execute_context(
    1640          dialect,
    ..................................................
     self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50>
     elem = <sqlalchemy.sql.dml.Update object at 0x7f136b165010>
     distilled_parameters = [
                             {'tab': 0,
                              'playlists_id': 133}, ]
     execution_options = immutabledict
                         {'compiled_cache': <sqlalchemy.util._collections.LRUCache ob
                          ject at 0x7f13ec20c590>}
     for_executemany = False
     schema_translate_map = None
     self.dialect.compiler_linting = 1
     compiler.WARN_LINTING = <Linting.WARN_LINTING: 2>
     self._execute_context = <method 'Connection._execute_context' of <sqlalchemy.engine.
                              base.Connection object at 0x7f136b617f50> base.py:1790>
     dialect = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje
                ct at 0x7f142196b3d0>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context
    1790  def _execute_context(
    1791      self,
    1792      dialect: Dialect,
    1793      constructor: Callable[..., ExecutionContext],
    1794      statement: Union[str, Compiled],
    1795      parameters: Optional[_AnyMultiExecuteParams],
    1796      execution_options: _ExecuteOptions,
    1797      *args: Any,
    1798      **kw: Any,
    1799  ) -> CursorResult[Any]:
 (...)
    1844              dialect,
    1845              context,
    1846          )
    1847      else:
--> 1848          return self._exec_single_context(
    1849              dialect, context, statement, parameters
    ..................................................
     self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50>
     dialect = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje
                ct at 0x7f142196b3d0>
     constructor = <method 'DefaultExecutionContext._init_compiled' of <class '
                    sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mysq
                    ldb'> default.py:1274>
     statement = <sqlalchemy.dialects.mysql.mysqldb.MySQLCompiler_mysqldb obj
                  ect at 0x7f136b61bdd0>
     parameters = [
                   {'tab': 0,
                    'playlists_id': 133}, ]
     execution_options = immutabledict
                         {'compiled_cache': <sqlalchemy.util._collections.LRUCache ob
                          ject at 0x7f13ec20c590>}
     args = (<sqlalchemy.dialects.mysql.mysqldb.MySQLCompiler_mysqldb ob
             ject at 0x7f136b61bdd0>, [{...}, ], <sqlalchemy.sql.dml.Upda
             te object at 0x7f136b165010>, [BindParameter('playlists_id',
              None, type_=Integer()), ], )
     kw = {'cache_hit': <CacheStats.CACHE_MISS: 1>}
     context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys
                qldb object at 0x7f136b619c10>
     self._exec_single_context = <method 'Connection._exec_single_context' of <sqlalchemy.eng
                                  ine.base.Connection object at 0x7f136b617f50> base.py:1852>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context
    1852  def _exec_single_context(
    1853      self,
    1854      dialect: Dialect,
    1855      context: ExecutionContext,
    1856      statement: Union[str, Compiled],
    1857      parameters: Optional[_AnyMultiExecuteParams],
    1858  ) -> CursorResult[Any]:
 (...)
    1984  
    1985          result = context._setup_result_proxy()
    1986  
    1987      except BaseException as e:
--> 1988          self._handle_dbapi_exception(
    1989              e, str_statement, effective_parameters, cursor, context
    ..................................................
     self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50>
     dialect = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje
                ct at 0x7f142196b3d0>
     context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys
                qldb object at 0x7f136b619c10>
     statement = <sqlalchemy.dialects.mysql.mysqldb.MySQLCompiler_mysqldb obj
                  ect at 0x7f136b61bdd0>
     parameters = [(0, 133, ), ]
     context._setup_result_proxy = <method 'DefaultExecutionContext._setup_result_proxy' of <sq
                                    lalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mysqld
                                    b object at 0x7f136b619c10> default.py:1787>
     self._handle_dbapi_exception = <method 'Connection._handle_dbapi_exception' of <sqlalchemy.
                                     engine.base.Connection object at 0x7f136b617f50> base.py:221
                                     3>
     str_statement = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s'
     effective_parameters = (0, 133, )
     cursor = <MySQLdb.cursors.Cursor object at 0x7f136b61b390>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2343, in _handle_dbapi_exception
    2213  def _handle_dbapi_exception(
    2214      self,
    2215      e: BaseException,
    2216      statement: Optional[str],
    2217      parameters: Optional[_AnyExecuteParams],
    2218      cursor: Optional[DBAPICursor],
    2219      context: Optional[ExecutionContext],
    2220      is_sub_exec: bool = False,
    2221  ) -> NoReturn:
 (...)
    2339          if newraise:
    2340              raise newraise.with_traceback(exc_info[2]) from e
    2341          elif should_wrap:
    2342              assert sqlalchemy_exception is not None
--> 2343              raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
    2344          else:
    ..................................................
     self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50>
     e = IntegrityError(1062, "Duplicate entry '0' for key 'tab'")
     statement = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s'
     parameters = (0, 133, )
     cursor = <MySQLdb.cursors.Cursor object at 0x7f136b61b390>
     context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys
                qldb object at 0x7f136b619c10>
     is_sub_exec = False
     newraise = None
     newraise.with_traceback = # AttributeError
          newraise = None
     exc_info = (<class 'MySQLdb.IntegrityError'>, IntegrityError(1062, "Dup
                 licate entry '0' for key 'tab'"), <traceback object at 0x7f1
                 3ec553440>, )
     should_wrap = True
     sqlalchemy_exception = IntegrityError('(MySQLdb.IntegrityError) (1062, "Duplicate e
                             ntry \'0\' for key \'tab\'")')
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
    1852  def _exec_single_context(
    1853      self,
    1854      dialect: Dialect,
    1855      context: ExecutionContext,
    1856      statement: Union[str, Compiled],
    1857      parameters: Optional[_AnyMultiExecuteParams],
    1858  ) -> CursorResult[Any]:
 (...)
    1965                      ):
    1966                          evt_handled = True
    1967                          break
    1968              if not evt_handled:
--> 1969                  self.dialect.do_execute(
    1970                      cursor, str_statement, effective_parameters, context
    ..................................................
     self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50>
     dialect = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje
                ct at 0x7f142196b3d0>
     context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys
                qldb object at 0x7f136b619c10>
     statement = <sqlalchemy.dialects.mysql.mysqldb.MySQLCompiler_mysqldb obj
                  ect at 0x7f136b61bdd0>
     parameters = [(0, 133, ), ]
     evt_handled = False
     self.dialect.do_execute = <method 'DefaultDialect.do_execute' of <sqlalchemy.dialects.
                                mysql.mysqldb.MySQLDialect_mysqldb object at 0x7f142196b3d0>
                                 default.py:921>
     cursor = <MySQLdb.cursors.Cursor object at 0x7f136b61b390>
     str_statement = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s'
     effective_parameters = (0, 133, )
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
    921  def do_execute(self, cursor, statement, parameters, context=None):
--> 922      cursor.execute(statement, parameters)
    ..................................................
     self = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje
             ct at 0x7f142196b3d0>
     cursor = <MySQLdb.cursors.Cursor object at 0x7f136b61b390>
     statement = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s'
     parameters = (0, 133, )
     context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys
                qldb object at 0x7f136b619c10>
     cursor.execute = <method 'BaseCursor.execute' of <MySQLdb.cursors.Cursor obje
                       ct at 0x7f136b61b390> cursors.py:162>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute
    162  def execute(self, query, args=None):
 (...)
    175  
    176      mogrified_query = self._mogrify(query, args)
    177  
    178      assert isinstance(mogrified_query, (bytes, bytearray))
--> 179      res = self._query(mogrified_query)
    180      return res
    ..................................................
     self = <MySQLdb.cursors.Cursor object at 0x7f136b61b390>
     query = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s'
     args = (0, 133, )
     mogrified_query = b'UPDATE playlists SET tab=0 WHERE playlists.id = 133'
     self._mogrify = <method 'BaseCursor._mogrify' of <MySQLdb.cursors.Cursor obj
                      ect at 0x7f136b61b390> cursors.py:182>
     self._query = <method 'BaseCursor._query' of <MySQLdb.cursors.Cursor objec
                    t at 0x7f136b61b390> cursors.py:325>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query
    325  def _query(self, q):
    326      db = self._get_db()
    327      self._result = None
    328      self.rowcount = None
    329      self.lastrowid = None
--> 330      db.query(q)
    331      self._do_get_result(db)
    ..................................................
     self = <MySQLdb.cursors.Cursor object at 0x7f136b61b390>
     q = b'UPDATE playlists SET tab=0 WHERE playlists.id = 133'
     db = <_mysql.connection open to 'localhost' at 0x27f46f0>
     self._get_db = <method 'BaseCursor._get_db' of <MySQLdb.cursors.Cursor obje
                     ct at 0x7f136b61b390> cursors.py:156>
     self._result = None
     self.rowcount = None
     self.lastrowid = None
     db.query = <method 'Connection.query' of <_mysql.connection open to 'lo
                 calhost' at 0x27f46f0> connections.py:251>
     self._do_get_result = <method 'BaseCursor._do_get_result' of <MySQLdb.cursors.Curs
                            or object at 0x7f136b61b390> cursors.py:135>
    ..................................................

File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/connections.py", line 255, in query
    251  def query(self, query):
    252      # Since _mysql releases GIL while querying, we need immutable buffer.
    253      if isinstance(query, bytearray):
    254          query = bytes(query)
--> 255      _mysql.connection.query(self, query)
    ..................................................
     query = b'UPDATE playlists SET tab=0 WHERE playlists.id = 133'
     self = <_mysql.connection open to 'localhost' at 0x27f46f0>
    ..................................................

---- (full traceback above) ----
File "/home/kae/mm/app/musicmuster.py", line 469, in closeEvent
    session.flush()
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/scoping.py", line 941, in flush
    return self._proxied.flush(objects=objects)
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4312, in flush
    self._flush(objects)
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4447, in _flush
    with util.safe_reraise():
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4408, in _flush
    flush_context.execute()
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute
    rec.execute(self)
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute
    util.preloaded.orm_persistence.save_obj(
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 85, in save_obj
    _emit_update_statements(
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 909, in _emit_update_statements
    c = connection.execute(
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
    return meth(
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection
    return connection._execute_clauseelement(
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement
    ret = self._execute_context(
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context
    return self._exec_single_context(
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context
    self._handle_dbapi_exception(
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2343, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context
    self.dialect.do_execute(
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute
    cursor.execute(statement, parameters)
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute
    res = self._query(mogrified_query)
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query
    db.query(q)
File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/connections.py", line 255, in query
    _mysql.connection.query(self, query)

IntegrityError: (MySQLdb.IntegrityError) (1062, "Duplicate entry '0' for key 'tab'")
[SQL: UPDATE playlists SET tab=%s WHERE playlists.id = %s]
[parameters: (0, 133)]
(Background on this error at: https://sqlalche.me/e/20/gkpj)
Deleting rows at end of playlist left three blank rows with "-1" in first column. Also had exception on quitting: ``` File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context 1852 def _exec_single_context( 1853 self, 1854 dialect: Dialect, 1855 context: ExecutionContext, 1856 statement: Union[str, Compiled], 1857 parameters: Optional[_AnyMultiExecuteParams], 1858 ) -> CursorResult[Any]: (...) 1965 ): 1966 evt_handled = True 1967 break 1968 if not evt_handled: --> 1969 self.dialect.do_execute( 1970 cursor, str_statement, effective_parameters, context .................................................. self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50> dialect = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje ct at 0x7f142196b3d0> context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys qldb object at 0x7f136b619c10> statement = <sqlalchemy.dialects.mysql.mysqldb.MySQLCompiler_mysqldb obj ect at 0x7f136b61bdd0> parameters = [(0, 133, ), ] evt_handled = False self.dialect.do_execute = <method 'DefaultDialect.do_execute' of <sqlalchemy.dialects. mysql.mysqldb.MySQLDialect_mysqldb object at 0x7f142196b3d0> default.py:921> cursor = <MySQLdb.cursors.Cursor object at 0x7f136b61b390> str_statement = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s' effective_parameters = (0, 133, ) .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute 921 def do_execute(self, cursor, statement, parameters, context=None): --> 922 cursor.execute(statement, parameters) .................................................. self = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje ct at 0x7f142196b3d0> cursor = <MySQLdb.cursors.Cursor object at 0x7f136b61b390> statement = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s' parameters = (0, 133, ) context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys qldb object at 0x7f136b619c10> cursor.execute = <method 'BaseCursor.execute' of <MySQLdb.cursors.Cursor obje ct at 0x7f136b61b390> cursors.py:162> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute 162 def execute(self, query, args=None): (...) 175 176 mogrified_query = self._mogrify(query, args) 177 178 assert isinstance(mogrified_query, (bytes, bytearray)) --> 179 res = self._query(mogrified_query) 180 return res .................................................. self = <MySQLdb.cursors.Cursor object at 0x7f136b61b390> query = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s' args = (0, 133, ) mogrified_query = b'UPDATE playlists SET tab=0 WHERE playlists.id = 133' self._mogrify = <method 'BaseCursor._mogrify' of <MySQLdb.cursors.Cursor obj ect at 0x7f136b61b390> cursors.py:182> self._query = <method 'BaseCursor._query' of <MySQLdb.cursors.Cursor objec t at 0x7f136b61b390> cursors.py:325> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query 325 def _query(self, q): 326 db = self._get_db() 327 self._result = None 328 self.rowcount = None 329 self.lastrowid = None --> 330 db.query(q) 331 self._do_get_result(db) .................................................. self = <MySQLdb.cursors.Cursor object at 0x7f136b61b390> q = b'UPDATE playlists SET tab=0 WHERE playlists.id = 133' db = <_mysql.connection open to 'localhost' at 0x27f46f0> self._get_db = <method 'BaseCursor._get_db' of <MySQLdb.cursors.Cursor obje ct at 0x7f136b61b390> cursors.py:156> self._result = None self.rowcount = None self.lastrowid = None db.query = <method 'Connection.query' of <_mysql.connection open to 'lo calhost' at 0x27f46f0> connections.py:251> self._do_get_result = <method 'BaseCursor._do_get_result' of <MySQLdb.cursors.Curs or object at 0x7f136b61b390> cursors.py:135> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/connections.py", line 255, in query 251 def query(self, query): 252 # Since _mysql releases GIL while querying, we need immutable buffer. 253 if isinstance(query, bytearray): 254 query = bytes(query) --> 255 _mysql.connection.query(self, query) .................................................. query = b'UPDATE playlists SET tab=0 WHERE playlists.id = 133' self = <_mysql.connection open to 'localhost' at 0x27f46f0> .................................................. ---- (full traceback above) ---- File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context self.dialect.do_execute( File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute cursor.execute(statement, parameters) File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute res = self._query(mogrified_query) File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query db.query(q) File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/connections.py", line 255, in query _mysql.connection.query(self, query) IntegrityError: (1062, "Duplicate entry '0' for key 'tab'") The above exception was the direct cause of the following exception: File "/home/kae/mm/app/musicmuster.py", line 469, in closeEvent 419 def closeEvent(self, event: Optional[QCloseEvent]) -> None: (...) 465 playlist_id = self.tabPlaylist.widget(idx).playlist_id 466 playlist = session.get(Playlists, playlist_id) 467 if playlist: 468 playlist.tab = idx --> 469 session.flush() 470 .................................................. self = <__main__.Window object at 0x7f1420f163b0> event = <PyQt6.QtGui.QCloseEvent object at 0x7f13ec7c2320> playlist_id = 133 idx = 0 playlist = # error calling repr and str session.get = <method 'scoped_session.get' of <sqlalchemy.orm.scoping.scop ed_session object at 0x7f13ec506c90> scoping.py:943> playlist.tab = # PendingRollbackError playlist = # error calling repr and str session.flush = <method 'scoped_session.flush' of <sqlalchemy.orm.scoping.sc oped_session object at 0x7f13ec506c90> scoping.py:912> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/scoping.py", line 941, in flush 912 def flush(self, objects: Optional[Sequence[Any]] = None) -> None: (...) 937 938 939 """ # noqa: E501 940 --> 941 return self._proxied.flush(objects=objects) .................................................. objects = None self._proxied.flush = <method 'Session.flush' of <sqlalchemy.orm.session.Session o bject at 0x7f13ec506710> session.py:4282> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4312, in flush 4282 def flush(self, objects: Optional[Sequence[Any]] = None) -> None: (...) 4308 if self._is_clean(): 4309 return 4310 try: 4311 self._flushing = True --> 4312 self._flush(objects) 4313 finally: .................................................. self = <sqlalchemy.orm.session.Session object at 0x7f13ec506710> objects = None self._is_clean = <method 'Session._is_clean' of <sqlalchemy.orm.session.Sessi on object at 0x7f13ec506710> session.py:4324> self._flushing = False self._flush = <method 'Session._flush' of <sqlalchemy.orm.session.Session object at 0x7f13ec506710> session.py:4331> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4447, in _flush 4331 def _flush(self, objects: Optional[Sequence[object]] = None) -> None: (...) 4443 4444 transaction.commit() 4445 4446 except: --> 4447 with util.safe_reraise(): 4448 transaction.rollback(_capture_exception=True) .................................................. self = <sqlalchemy.orm.session.Session object at 0x7f13ec506710> objects = None transaction.commit = <method 'SessionTransaction.commit' of <sqlalchemy.orm.sessi on.SessionTransaction object at 0x7f13ec6bbed0> <string>:1> transaction.rollback = <method 'SessionTransaction.rollback' of <sqlalchemy.orm.ses sion.SessionTransaction object at 0x7f13ec6bbed0> <string>:1 .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__ 134 def __exit__( 135 self, 136 type_: Optional[Type[BaseException]], 137 value: Optional[BaseException], 138 traceback: Optional[types.TracebackType], 139 ) -> NoReturn: (...) 142 if type_ is None: 143 exc_type, exc_value, exc_tb = self._exc_info 144 assert exc_value is not None 145 self._exc_info = None # remove potential circular references --> 146 raise exc_value.with_traceback(exc_tb) 147 else: .................................................. self = <sqlalchemy.util.langhelpers.safe_reraise object at 0x7f13ec 7fb4f0> type_ = None value = None traceback = None exc_value = IntegrityError('(MySQLdb.IntegrityError) (1062, "Duplicate e ntry \'0\' for key \'tab\'")') exc_tb = <traceback object at 0x7f13ec550a40> self._exc_info = None .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4408, in _flush 4331 def _flush(self, objects: Optional[Sequence[object]] = None) -> None: (...) 4404 flush_context.transaction = transaction = self._autobegin_t()._begin() 4405 try: 4406 self._warn_on_events = True 4407 try: --> 4408 flush_context.execute() 4409 finally: .................................................. self = <sqlalchemy.orm.session.Session object at 0x7f13ec506710> objects = None flush_context.transaction = <sqlalchemy.orm.session.SessionTransaction object at 0x7f13e c6bbed0> transaction = <sqlalchemy.orm.session.SessionTransaction object at 0x7f13e c6bbed0> self._autobegin_t = <method 'Session._autobegin_t' of <sqlalchemy.orm.session.Se ssion object at 0x7f13ec506710> session.py:1813> self._warn_on_events = False flush_context.execute = <method 'UOWTransaction.execute' of <sqlalchemy.orm.unitofwo rk.UOWTransaction object at 0x7f136b616990> unitofwork.py:44 1> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute 441 def execute(self) -> None: (...) 462 n = set_.pop() 463 n.execute_aggregate(self, set_) 464 else: 465 for rec in topological.sort(self.dependencies, postsort_actions): --> 466 rec.execute(self) .................................................. self = <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7f136b 616990> rec = SaveUpdateAll(Mapper[Playlists(playlists)]) topological.sort = <function 'sort' topological.py:58> self.dependencies = {(SaveUpdateAll(Mapper[Playlists(playlists)]), DeleteAll(Map per[Playlists(playlists)]), ), } postsort_actions = [DeleteAll(Mapper[Playlists(playlists)]), SaveUpdateAll(Mapp er[Playlists(playlists)]), ] rec.execute = <method 'SaveUpdateAll.execute' of SaveUpdateAll(Mapper[Play lists(playlists)]) unitofwork.py:640> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute 640 @util.preload_module("sqlalchemy.orm.persistence") 641 def execute(self, uow): --> 642 util.preloaded.orm_persistence.save_obj( 643 self.mapper, .................................................. util.preload_module = <method '_ModuleRegistry.preload_module' of <sqlalchemy.util .preloaded._ModuleRegistry object at 0x7f142718fdd0> preload ed.py:118> self = SaveUpdateAll(Mapper[Playlists(playlists)]) uow = <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7f136b 616990> util.preloaded.orm_persistence.save_obj = <function 'save_obj' persistence.py:40> self.mapper = <Mapper at 0x7f14218b54d0; Playlists> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 85, in save_obj 40 def save_obj(base_mapper, states, uowtransaction, single=False): (...) 81 update = _collect_update_commands( 82 uowtransaction, table, states_to_update 83 ) 84 --> 85 _emit_update_statements( 86 base_mapper, .................................................. base_mapper = <Mapper at 0x7f14218b54d0; Playlists> states = <generator object UOWTransaction.states_for_mapper_hierarchy at 0x7f1415006140> uowtransaction = <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7f136b 616990> single = False update = <generator object _collect_update_commands at 0x7f14216fbc40 table = Table('playlists', MetaData(), Column('id', Integer(), table =<playlists>, primary_key=True, nullable=False), Column('nam e', String(length=32), table=<playlists>, nullable=False), C olumn('last_used', DateTime(), table=<playlists>), Column('t ab', Integer(), table=<playlists>), Column('open', Boolean() , table=<playlists>, nullable=False, default=ScalarElementCo lumnDefault(False)), Column('is_template', Boolean(), table= <playlists>, nullable=False, default=ScalarElementColumnDefa ult(False)), Column(... states_to_update = [(<sqlalchemy.orm.state.InstanceState object at 0x7f13ec7e05 30>, {...}, <Mapper at 0x7f14218b54d0; Playlists>, <sqlalche my.engine.base.Connection object at 0x7f136b617f50>, None, ) , ] .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 909, in _emit_update_statements 725 def _emit_update_statements( 726 base_mapper, 727 uowtransaction, 728 mapper, 729 table, 730 update, 731 *, 732 bookkeeping=True, 733 use_orm_update_stmt=None, 734 enable_check_rowcount=True, 735 ): (...) 905 assert_multirow 906 or (assert_singlerow and len(multiparams) == 1) 907 ) 908 --> 909 c = connection.execute( 910 statement, multiparams, execution_options=execution_options .................................................. base_mapper = <Mapper at 0x7f14218b54d0; Playlists> uowtransaction = <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x7f136b 616990> mapper = <Mapper at 0x7f14218b54d0; Playlists> table = Table('playlists', MetaData(), Column('id', Integer(), table =<playlists>, primary_key=True, nullable=False), Column('nam e', String(length=32), table=<playlists>, nullable=False), C olumn('last_used', DateTime(), table=<playlists>), Column('t ab', Integer(), table=<playlists>), Column('open', Boolean() , table=<playlists>, nullable=False, default=ScalarElementCo lumnDefault(False)), Column('is_template', Boolean(), table= <playlists>, nullable=False, default=ScalarElementColumnDefa ult(False)), Column(... update = <generator object _collect_update_commands at 0x7f14216fbc40 bookkeeping = True use_orm_update_stmt = None enable_check_rowcount = True assert_multirow = True assert_singlerow = True multiparams = [ {'tab': 0, 'playlists_id': 133}, ] connection.execute = <method 'Connection.execute' of <sqlalchemy.engine.base.Conn ection object at 0x7f136b617f50> base.py:1372> statement = <sqlalchemy.sql.dml.Update object at 0x7f136b165010> execution_options = {'compiled_cache': <sqlalchemy.util._collections.LRUCache ob ject at 0x7f13ec20c590>} .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1416, in execute 1372 def execute( 1373 self, 1374 statement: Executable, 1375 parameters: Optional[_CoreAnyExecuteParams] = None, 1376 *, 1377 execution_options: Optional[CoreExecuteOptionsParameter] = None, 1378 ) -> CursorResult[Any]: (...) 1412 meth = statement._execute_on_connection 1413 except AttributeError as err: 1414 raise exc.ObjectNotExecutableError(statement) from err 1415 else: --> 1416 return meth( 1417 self, .................................................. self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50> statement = <sqlalchemy.sql.dml.Update object at 0x7f136b165010> parameters = [ {'tab': 0, 'playlists_id': 133}, ] execution_options = {'compiled_cache': <sqlalchemy.util._collections.LRUCache ob ject at 0x7f13ec20c590>} meth = <method 'ClauseElement._execute_on_connection' of UPDATE pla ylists SET id=:id, name=:name, last_used=:last_used, tab=:ta b, open=:open, is_template=:is_template, deleted=:deleted WH ERE playlists.id = :playlists_id elements.py:507> statement._execute_on_connection = <method 'ClauseElement._execute_on_connection' of UPDATE pla ylists SET id=:id, name=:name, last_used=:last_used, tab=:ta b, open=:open, is_template=:is_template, deleted=:deleted WH ERE playlists.id = :playlists_id elements.py:507> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection 507 def _execute_on_connection( 508 self, 509 connection: Connection, 510 distilled_params: _CoreMultiExecuteParams, 511 execution_options: CoreExecuteOptionsParameter, 512 ) -> Result[Any]: 513 if self.supports_execution: 514 if TYPE_CHECKING: 515 assert isinstance(self, Executable) --> 516 return connection._execute_clauseelement( 517 self, distilled_params, execution_options .................................................. self = <sqlalchemy.sql.dml.Update object at 0x7f136b165010> connection = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50> distilled_params = [ {'tab': 0, 'playlists_id': 133}, ] execution_options = {'compiled_cache': <sqlalchemy.util._collections.LRUCache ob ject at 0x7f13ec20c590>} self.supports_execution = True TYPE_CHECKING = False connection._execute_clauseelement = <method 'Connection._execute_clauseelement' of <sqlalchemy.e ngine.base.Connection object at 0x7f136b617f50> base.py:1589 .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement 1589 def _execute_clauseelement( 1590 self, 1591 elem: Executable, 1592 distilled_parameters: _CoreMultiExecuteParams, 1593 execution_options: CoreExecuteOptionsParameter, 1594 ) -> CursorResult[Any]: (...) 1635 for_executemany=for_executemany, 1636 schema_translate_map=schema_translate_map, 1637 linting=self.dialect.compiler_linting | compiler.WARN_LINTING, 1638 ) --> 1639 ret = self._execute_context( 1640 dialect, .................................................. self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50> elem = <sqlalchemy.sql.dml.Update object at 0x7f136b165010> distilled_parameters = [ {'tab': 0, 'playlists_id': 133}, ] execution_options = immutabledict {'compiled_cache': <sqlalchemy.util._collections.LRUCache ob ject at 0x7f13ec20c590>} for_executemany = False schema_translate_map = None self.dialect.compiler_linting = 1 compiler.WARN_LINTING = <Linting.WARN_LINTING: 2> self._execute_context = <method 'Connection._execute_context' of <sqlalchemy.engine. base.Connection object at 0x7f136b617f50> base.py:1790> dialect = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje ct at 0x7f142196b3d0> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context 1790 def _execute_context( 1791 self, 1792 dialect: Dialect, 1793 constructor: Callable[..., ExecutionContext], 1794 statement: Union[str, Compiled], 1795 parameters: Optional[_AnyMultiExecuteParams], 1796 execution_options: _ExecuteOptions, 1797 *args: Any, 1798 **kw: Any, 1799 ) -> CursorResult[Any]: (...) 1844 dialect, 1845 context, 1846 ) 1847 else: --> 1848 return self._exec_single_context( 1849 dialect, context, statement, parameters .................................................. self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50> dialect = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje ct at 0x7f142196b3d0> constructor = <method 'DefaultExecutionContext._init_compiled' of <class ' sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mysq ldb'> default.py:1274> statement = <sqlalchemy.dialects.mysql.mysqldb.MySQLCompiler_mysqldb obj ect at 0x7f136b61bdd0> parameters = [ {'tab': 0, 'playlists_id': 133}, ] execution_options = immutabledict {'compiled_cache': <sqlalchemy.util._collections.LRUCache ob ject at 0x7f13ec20c590>} args = (<sqlalchemy.dialects.mysql.mysqldb.MySQLCompiler_mysqldb ob ject at 0x7f136b61bdd0>, [{...}, ], <sqlalchemy.sql.dml.Upda te object at 0x7f136b165010>, [BindParameter('playlists_id', None, type_=Integer()), ], ) kw = {'cache_hit': <CacheStats.CACHE_MISS: 1>} context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys qldb object at 0x7f136b619c10> self._exec_single_context = <method 'Connection._exec_single_context' of <sqlalchemy.eng ine.base.Connection object at 0x7f136b617f50> base.py:1852> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context 1852 def _exec_single_context( 1853 self, 1854 dialect: Dialect, 1855 context: ExecutionContext, 1856 statement: Union[str, Compiled], 1857 parameters: Optional[_AnyMultiExecuteParams], 1858 ) -> CursorResult[Any]: (...) 1984 1985 result = context._setup_result_proxy() 1986 1987 except BaseException as e: --> 1988 self._handle_dbapi_exception( 1989 e, str_statement, effective_parameters, cursor, context .................................................. self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50> dialect = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje ct at 0x7f142196b3d0> context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys qldb object at 0x7f136b619c10> statement = <sqlalchemy.dialects.mysql.mysqldb.MySQLCompiler_mysqldb obj ect at 0x7f136b61bdd0> parameters = [(0, 133, ), ] context._setup_result_proxy = <method 'DefaultExecutionContext._setup_result_proxy' of <sq lalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mysqld b object at 0x7f136b619c10> default.py:1787> self._handle_dbapi_exception = <method 'Connection._handle_dbapi_exception' of <sqlalchemy. engine.base.Connection object at 0x7f136b617f50> base.py:221 3> str_statement = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s' effective_parameters = (0, 133, ) cursor = <MySQLdb.cursors.Cursor object at 0x7f136b61b390> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2343, in _handle_dbapi_exception 2213 def _handle_dbapi_exception( 2214 self, 2215 e: BaseException, 2216 statement: Optional[str], 2217 parameters: Optional[_AnyExecuteParams], 2218 cursor: Optional[DBAPICursor], 2219 context: Optional[ExecutionContext], 2220 is_sub_exec: bool = False, 2221 ) -> NoReturn: (...) 2339 if newraise: 2340 raise newraise.with_traceback(exc_info[2]) from e 2341 elif should_wrap: 2342 assert sqlalchemy_exception is not None --> 2343 raise sqlalchemy_exception.with_traceback(exc_info[2]) from e 2344 else: .................................................. self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50> e = IntegrityError(1062, "Duplicate entry '0' for key 'tab'") statement = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s' parameters = (0, 133, ) cursor = <MySQLdb.cursors.Cursor object at 0x7f136b61b390> context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys qldb object at 0x7f136b619c10> is_sub_exec = False newraise = None newraise.with_traceback = # AttributeError newraise = None exc_info = (<class 'MySQLdb.IntegrityError'>, IntegrityError(1062, "Dup licate entry '0' for key 'tab'"), <traceback object at 0x7f1 3ec553440>, ) should_wrap = True sqlalchemy_exception = IntegrityError('(MySQLdb.IntegrityError) (1062, "Duplicate e ntry \'0\' for key \'tab\'")') .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context 1852 def _exec_single_context( 1853 self, 1854 dialect: Dialect, 1855 context: ExecutionContext, 1856 statement: Union[str, Compiled], 1857 parameters: Optional[_AnyMultiExecuteParams], 1858 ) -> CursorResult[Any]: (...) 1965 ): 1966 evt_handled = True 1967 break 1968 if not evt_handled: --> 1969 self.dialect.do_execute( 1970 cursor, str_statement, effective_parameters, context .................................................. self = <sqlalchemy.engine.base.Connection object at 0x7f136b617f50> dialect = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje ct at 0x7f142196b3d0> context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys qldb object at 0x7f136b619c10> statement = <sqlalchemy.dialects.mysql.mysqldb.MySQLCompiler_mysqldb obj ect at 0x7f136b61bdd0> parameters = [(0, 133, ), ] evt_handled = False self.dialect.do_execute = <method 'DefaultDialect.do_execute' of <sqlalchemy.dialects. mysql.mysqldb.MySQLDialect_mysqldb object at 0x7f142196b3d0> default.py:921> cursor = <MySQLdb.cursors.Cursor object at 0x7f136b61b390> str_statement = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s' effective_parameters = (0, 133, ) .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute 921 def do_execute(self, cursor, statement, parameters, context=None): --> 922 cursor.execute(statement, parameters) .................................................. self = <sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb obje ct at 0x7f142196b3d0> cursor = <MySQLdb.cursors.Cursor object at 0x7f136b61b390> statement = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s' parameters = (0, 133, ) context = <sqlalchemy.dialects.mysql.mysqldb.MySQLExecutionContext_mys qldb object at 0x7f136b619c10> cursor.execute = <method 'BaseCursor.execute' of <MySQLdb.cursors.Cursor obje ct at 0x7f136b61b390> cursors.py:162> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute 162 def execute(self, query, args=None): (...) 175 176 mogrified_query = self._mogrify(query, args) 177 178 assert isinstance(mogrified_query, (bytes, bytearray)) --> 179 res = self._query(mogrified_query) 180 return res .................................................. self = <MySQLdb.cursors.Cursor object at 0x7f136b61b390> query = 'UPDATE playlists SET tab=%s WHERE playlists.id = %s' args = (0, 133, ) mogrified_query = b'UPDATE playlists SET tab=0 WHERE playlists.id = 133' self._mogrify = <method 'BaseCursor._mogrify' of <MySQLdb.cursors.Cursor obj ect at 0x7f136b61b390> cursors.py:182> self._query = <method 'BaseCursor._query' of <MySQLdb.cursors.Cursor objec t at 0x7f136b61b390> cursors.py:325> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query 325 def _query(self, q): 326 db = self._get_db() 327 self._result = None 328 self.rowcount = None 329 self.lastrowid = None --> 330 db.query(q) 331 self._do_get_result(db) .................................................. self = <MySQLdb.cursors.Cursor object at 0x7f136b61b390> q = b'UPDATE playlists SET tab=0 WHERE playlists.id = 133' db = <_mysql.connection open to 'localhost' at 0x27f46f0> self._get_db = <method 'BaseCursor._get_db' of <MySQLdb.cursors.Cursor obje ct at 0x7f136b61b390> cursors.py:156> self._result = None self.rowcount = None self.lastrowid = None db.query = <method 'Connection.query' of <_mysql.connection open to 'lo calhost' at 0x27f46f0> connections.py:251> self._do_get_result = <method 'BaseCursor._do_get_result' of <MySQLdb.cursors.Curs or object at 0x7f136b61b390> cursors.py:135> .................................................. File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/connections.py", line 255, in query 251 def query(self, query): 252 # Since _mysql releases GIL while querying, we need immutable buffer. 253 if isinstance(query, bytearray): 254 query = bytes(query) --> 255 _mysql.connection.query(self, query) .................................................. query = b'UPDATE playlists SET tab=0 WHERE playlists.id = 133' self = <_mysql.connection open to 'localhost' at 0x27f46f0> .................................................. ---- (full traceback above) ---- File "/home/kae/mm/app/musicmuster.py", line 469, in closeEvent session.flush() File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/scoping.py", line 941, in flush return self._proxied.flush(objects=objects) File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4312, in flush self._flush(objects) File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4447, in _flush with util.safe_reraise(): File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__ raise exc_value.with_traceback(exc_tb) File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 4408, in _flush flush_context.execute() File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute rec.execute(self) File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute util.preloaded.orm_persistence.save_obj( File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 85, in save_obj _emit_update_statements( File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/persistence.py", line 909, in _emit_update_statements c = connection.execute( File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1416, in execute return meth( File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection return connection._execute_clauseelement( File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement ret = self._execute_context( File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context return self._exec_single_context( File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context self._handle_dbapi_exception( File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2343, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context self.dialect.do_execute( File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute cursor.execute(statement, parameters) File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in execute res = self._query(mogrified_query) File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _query db.query(q) File "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-21R3m3EB-py3.11/lib/python3.11/site-packages/MySQLdb/connections.py", line 255, in query _mysql.connection.query(self, query) IntegrityError: (MySQLdb.IntegrityError) (1062, "Duplicate entry '0' for key 'tab'") [SQL: UPDATE playlists SET tab=%s WHERE playlists.id = %s] [parameters: (0, 133)] (Background on this error at: https://sqlalche.me/e/20/gkpj) ```
kae added the
bug
label 2024-02-08 09:11:16 +00:00
kae referenced this issue from a commit 2024-02-10 15:52:17 +00:00
kae closed this issue 2024-02-10 15:52:17 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: kae/musicmuster#220
No description provided.