SHARE
TWEET

Untitled

a guest May 16th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # 1-3 이 쿼리는 의도한대로 +1개의 쿼리로 related_order를 조회한다
  2. # filter절에서 related_order에 대해 별다른 내용이 없어서 반항없이 개발자의 의도대로 따라준다.
  3. OrderedProduct.objects.filter(product_cnt=30).prefetch_related('related_order')
  4. """
  5.     SELECT *
  6.     FROM "orm_practice_app_orderedproduct"
  7.      WHERE "orm_practice_app_orderedproduct"."product_cnt" = 30;
  8.  
  9.     SELECT *
  10.      FROM "orm_practice_app_order"
  11.      WHERE "orm_practice_app_order"."id" IN (~~~~~~~);
  12.  
  13. """
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top