-
-
Notifications
You must be signed in to change notification settings - Fork 445
Description
Describe the bug
2024-06-21 00:36:31,185 [ERROR] Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/tortoise/models.py", line 730, in _init_from_db
setattr(self, model_field, kwargs[key])
KeyError: 'tenant_id'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/sanic/resource_quota/components/quota/handler.py", line 1243, in get_tenant_admin_machine_info
tenant_machine_obj = await TenantMachineModel.filter(**query_kwargs).all()
File "/usr/local/lib/python3.9/site-packages/tortoise/queryset.py", line 1006, in _execute
instance_list = await self._db.executor_class(
File "/usr/local/lib/python3.9/site-packages/tortoise/backends/base/executor.py", line 138, in execute_select
instance: "Model" = self.model._init_from_db(
File "/usr/local/lib/python3.9/site-packages/tortoise/models.py", line 747, in _init_from_db
setattr(self, key, meta.fields_map[key].to_python_value(value))
KeyError: '1'
我们的多个项目都使用了tortoise-orm,但是仅有一个项目在一段时间运行后,就会大量的爆出这个错误,但是重启服务之后,这个问题就会被修复,我们比对了多个服务之间使用orm的差异,发现几乎一致,因此想问下这个错误出现的场景和原因应该是怎样的