A freshly seeded test database, and choosing option 3 causes crash #16

Closed
opened 2024-07-28 00:23:06 +02:00 by oysteikt · 1 comment
Owner

Please investigate

$ rm worblehat.sqlite; poetry run poe migrate && poetry run worblehat devscripts seed-test-data
  ...
$ poetry run worblehat cli

*) Choose / Add item with its ISBN
1) Search
2) Show a bookcase, and its items
3) Show borrowed/queued items
4) Show slabbedasker
5) Save changes
6) Abort changes
7) Advanced options
9) Exit
> 3
No borrowed items found.

Traceback (most recent call last):
  File "/usr/lib/python3.12/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'WorblehatCli' object has no attribute 'do_3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 924, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: no such column: BookcaseItemBorrowingQueue.item_became_available_time

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

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/h7x4/pvv/worblehat/worblehat/main.py", line 60, in main
    WorblehatCli.run_with_safe_exit_wrapper(sql_session)
  File "/home/h7x4/pvv/worblehat/worblehat/cli/main.py", line 50, in run_with_safe_exit_wrapper
    tool.cmdloop()
  File "/usr/lib/python3.12/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/cmd.py", line 216, in onecmd
    return self.default(line)
           ^^^^^^^^^^^^^^^^^^
  File "/home/h7x4/pvv/worblehat/worblehat/cli/main.py", line 155, in default
    super()._default(isbn)
  File "/home/h7x4/pvv/worblehat/worblehat/cli/prompt_utils.py", line 156, in _default
    return self.funcs[i]['f'](self, arg)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/h7x4/pvv/worblehat/worblehat/cli/main.py", line 94, in do_show_borrowed_queued
    queued_items = self.sql_session.scalars(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2459, in scalars
    return self._execute_internal(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2236, in _execute_internal
    result: Result[Any] = compile_state_cls.orm_execute_statement(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement
    result = conn.execute(
             ^^^^^^^^^^^^^
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1418, in execute
    return meth(
           ^^^^^
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
    return connection._execute_clauseelement(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
    return self._exec_single_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2353, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 924, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: BookcaseItemBorrowingQueue.item_became_available_time
[SQL: SELECT "BookcaseItemBorrowingQueue".username, "BookcaseItemBorrowingQueue".entered_queue_time, "BookcaseItemBorrowingQueue".item_became_available_time, "BookcaseItemBorrowingQueue".expired, "BookcaseItemBorrowingQueue".fk_bookcase_item_uid, "BookcaseItemBorrowingQueue".uid
FROM "BookcaseItemBorrowingQueue" ORDER BY "BookcaseItemBorrowingQueue".entered_queue_time]
(Background on this error at: https://sqlalche.me/e/20/e3q8)

Please investigate ``` $ rm worblehat.sqlite; poetry run poe migrate && poetry run worblehat devscripts seed-test-data ... $ poetry run worblehat cli *) Choose / Add item with its ISBN 1) Search 2) Show a bookcase, and its items 3) Show borrowed/queued items 4) Show slabbedasker 5) Save changes 6) Abort changes 7) Advanced options 9) Exit > 3 No borrowed items found. Traceback (most recent call last): File "/usr/lib/python3.12/cmd.py", line 214, in onecmd func = getattr(self, 'do_' + cmd) ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'WorblehatCli' object has no attribute 'do_3' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 924, in do_execute cursor.execute(statement, parameters) sqlite3.OperationalError: no such column: BookcaseItemBorrowingQueue.item_became_available_time The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/h7x4/pvv/worblehat/worblehat/main.py", line 60, in main WorblehatCli.run_with_safe_exit_wrapper(sql_session) File "/home/h7x4/pvv/worblehat/worblehat/cli/main.py", line 50, in run_with_safe_exit_wrapper tool.cmdloop() File "/usr/lib/python3.12/cmd.py", line 138, in cmdloop stop = self.onecmd(line) ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/cmd.py", line 216, in onecmd return self.default(line) ^^^^^^^^^^^^^^^^^^ File "/home/h7x4/pvv/worblehat/worblehat/cli/main.py", line 155, in default super()._default(isbn) File "/home/h7x4/pvv/worblehat/worblehat/cli/prompt_utils.py", line 156, in _default return self.funcs[i]['f'](self, arg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/h7x4/pvv/worblehat/worblehat/cli/main.py", line 94, in do_show_borrowed_queued queued_items = self.sql_session.scalars( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2459, in scalars return self._execute_internal( ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2236, in _execute_internal result: Result[Any] = compile_state_cls.orm_execute_statement( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement result = conn.execute( ^^^^^^^^^^^^^ File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1418, in execute return meth( ^^^^^ File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection return connection._execute_clauseelement( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement ret = self._execute_context( ^^^^^^^^^^^^^^^^^^^^^^ File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context return self._exec_single_context( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context self._handle_dbapi_exception( File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2353, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/home/h7x4/.cache/pypoetry/virtualenvs/worblehat-SOiqnSfe-py3.12/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 924, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: BookcaseItemBorrowingQueue.item_became_available_time [SQL: SELECT "BookcaseItemBorrowingQueue".username, "BookcaseItemBorrowingQueue".entered_queue_time, "BookcaseItemBorrowingQueue".item_became_available_time, "BookcaseItemBorrowingQueue".expired, "BookcaseItemBorrowingQueue".fk_bookcase_item_uid, "BookcaseItemBorrowingQueue".uid FROM "BookcaseItemBorrowingQueue" ORDER BY "BookcaseItemBorrowingQueue".entered_queue_time] (Background on this error at: https://sqlalche.me/e/20/e3q8) ```
oysteikt added the
bug
label 2024-07-28 00:23:06 +02:00
oysteikt added this to the Initial release milestone 2024-07-28 00:24:01 +02:00
Author
Owner

Seemingly a database inconsistency. Fixed by 4e356f122a

Seemingly a database inconsistency. Fixed by 4e356f122a
oysteikt added the
crash report
label 2024-07-28 15:28:16 +02:00
Sign in to join this conversation.
No description provided.