title: django/python: raw sql with multiple tables
body: <p>I need to perform a raw sql on multiple tables. I then render the result set. For one table I would do:</p>
  
  <pre><code>sql = "select * from my_table"
  results = my_table.objects.raw(sql)
  </code></pre>
  
  <p>For multiple tables I am doing: </p>
  
  <pre><code>sql = "select * from my_table, my_other_table where ...."
  results = big_model.objects.raw(sql)
  </code></pre>
  
  <p>But, do I really need to create a table/model/class big_model, which contains all fields that I may need? I will never actually store any data in this "table".</p>
  
  <p>ADDED:</p>
  
  <p>I have a table my_users. I have a table my_listings. These are defined in Models.py. The table my_listings has a foreign key to my_users, indicating who created the listing. </p>
  
  <p>The SQL is </p>
  
  <pre><code>"select user_name, listing_text from my_listings, my_users where my_users.id = my_listings.my_user_id". 
  </code></pre>
  
  <p>I want this SQL to generate a result set that I can use to render my page in django. </p>
  
  <p>The question is: Do I have to create a model that contains the fields user_name and listing_text? Or is there some better way that still uses raw SQL (select, from, where)? Of course, my actual queries are more complicated than this example. (The models that I define in models.py become actual tables in the database hence the use of the model/table term. Not sure how else to refer to them, sorry.) I use raw sql because I found that python table references only work with  simple data models.</p>