Hello everyone,

I realize that it is a pretty exotic feature, but is there a way to =
generate SQL from a query set so that the fields can be a wildcard, when =
multiple joins exist.

Given this query:

SELECT *
FROM table1 t1
JOIN table2 t2 on t1.id = t2.t1_id
JOIN table3 t3 on t2.id = t3.t2_id
WHERE (...)


How can I use Django to rewrite the select as `SELECT t1.*` for example?

My use-case is a set of nested models with a foreign key relationship 
(t1 has many t2 has many t3) and I would like to query t2 but return
either t1, t2 or t3 instances depending on the cases (and presumably t1,
t2 and t3 are serializable as models in the ORM)

Is this possible? So far, I looked at `values` and `values_list` but 
there doesn't seem to be a documented way to do this.

Any help appreciated, I know this group is helpful,

-- Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7ebaf7d9-1f8a-4638-bd33-3932c538b5f1n%40googlegroups.com.

Reply via email to