title: Populating nested dictionary from database query
body: <p>I have data in a database that look like this (simplified)</p>
  
  <pre><code>colA, colB, colC
  'a',   1,   'abc'
  'a',   2,   'def'
  'b',   1,   'ghi'
  'b',   2,   'jkl'
  </code></pre>
  
  <p>My aim is to build a nested dictionary from that table, that looks like this:</p>
  
  <pre><code>dict = {a: {1: 'abc'}, {2: 'def'},
          b: {1: 'ghi'}, {2: 'jkl'}}
  </code></pre>
  
  <p>I have few more nested levels in my real case.
  Being a database query, I imagine I can do a 'for' loop line by line</p>
  
  <p>Any suggestion to an elegant/efficient way to populate a dictionary this way?</p>