How to query for dynamic attributes through Django EAV?

We have a tentative prototype working now, similar to the SQL snippet below. Hope to bring up people’s interest in EAV in our Django community.

We are still climbing the learning curve, but for any questions, just let me know.

select 
    t.id, t.create_ts
    -- ... a few other native columns from the `transaction` table
  , eav_postalcode.value_text as postalcode
  , eav_phone.value_text as phone
  -- ... to assemble more EAV attributes, 
  -- and according to `datatype` retrieve the `value_text`, `value_date`, etc.
from
  (
    select * from transactions
    where product_id = __PRODUCT_ID__
  ) as t
  left outer join eav_value as eav_postalcode
    on t.id = eav_postalcode.entity_id and eav_phone.attribute_id = 122
  left outer join eav_value as eav_phone
    on t.id = eav_phone.entity_id and eav_phone.attribute_id = 123
  -- ... to assemble more EAV attributes
;