-
Notifications
You must be signed in to change notification settings - Fork 63
Closed
Description
Hi there!
Since I've been using the library, I've noticed a strange error, which unfortunately doesn't occur reproducibly either. I share my observations here, maybe you have an idea.
relevant part of the stack trace
File "/opt/maddox/./modules/core/user_handler/user_handler.py", line 131, in get_user_by_id
return self._make_user_from_data_row(data_row=cursor.fetchone())
File "/opt/maddox/./modules/core/user_handler/user_handler.py", line 509, in _make_user_from_data_row
user_id = data_row['user_id']
KeyError: 'user_id'
relevant code section
def get_user_by_id(self, user_id: str, cursor: DictCursor) -> User:
result_count = cursor.execute(
query=Sql.GET_USER_BY_ID,
args=(user_id,),
)
if result_count != 1:
raise MaddoxException(msg=f'User with id "{user_id}" not found.')
return self._make_user_from_data_row(data_row=cursor.fetchone())
def _make_user_from_data_row(self, data_row: Dict[str, Any]) -> User:
user_id = data_row['user_id'] # KeyError is raised here
role = Role(data_row['role_id'])
# lots of other stuffSince _make_user_from_data_row was called like in the stacktrace above, it follows that result_count must have been equal to 1. But this is a contradiction to the KeyError which means, that are no rows to fetch.
Do you have an idea what could go wrong here?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels