외주업체에서 PK, FK를 문자열로 만들어놔서 join이 제대로 안됐다.
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
return view_func(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/usr/local/lib/python3.12/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/usr/local/lib/python3.12/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/fym/core/views/ranking_views.py", line 14, in get
result: ServiceResultDto = GetMainRankingService().get_ranking()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/fym/core/services/get_main_ranking_service.py", line 55, in get_ranking
self.product_service.set_media_id_and_image_url(products=product_view_ranking)
File "/fym/core/services/product_service.py", line 4, in set_media_id_and_image_url
print(f"@products : {products}", flush=True)
^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/django/db/models/query.py", line 376, in repr
data = list(self[: REPR_OUTPUT_SIZE + 1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/django/db/models/query.py", line 400, in iter
self._fetch_all()
File "/usr/local/lib/python3.12/site-packages/django/db/models/query.py", line 1930, in _fetch_all
self._prefetch_related_objects()
File "/usr/local/lib/python3.12/site-packages/django/db/models/query.py", line 1320, in _prefetch_related_objects
prefetch_related_objects(self._result_cache, *self._prefetch_related_lookups)
File "/usr/local/lib/python3.12/site-packages/django/db/models/query.py", line 2380, in prefetch_related_objects
obj_list, additional_lookups = prefetch_one_level(
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/django/db/models/query.py", line 2544, in prefetch_one_level
) = prefetcher.get_prefetch_querysets(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/django/db/models/fields/related_descriptors.py", line 799, in get_prefetch_querysets
instance = instances_dict[rel_obj_attr(rel_obj)]
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: ('24543',)
PK, FK 타입이 안맞는 경우 발생함.
타입을 통일시켜서 해결.