title: Sqlalchemy - add columns to a query
body: <p>For example I am using the <a href="https://chinookdatabase.codeplex.com/wikipage?title=Chinook_Schema&amp;referringTitle=Home" rel="noreferrer">chinook</a> database and I would like to convert the Name field into a slug. Slugify is a function from awesome-slugify.</p>
  
  <p>Something like this in SQL</p>
  
  <pre><code>Select *, slugify(Name) as name_slug
  from Artist
  </code></pre>
  
  <p>In sqlalchemy I have tried:</p>
  
  <pre><code>artist = Artist.query.add_columns(name_slug=slugify(Artist.Name)).all()
  </code></pre>
  
  <p>and </p>
  
  <pre><code>artist = Artist.query.add_columns(name_slug=[slugify(a.Name) for a in Artist.Name]).all()
  </code></pre>
  
  <p>I can generate a list of name slugs by doing to following in the terminal:</p>
  
  <pre><code>art = models.Artist.query.all()
  name_slug = [slugify(a.Name) for a in art]
  print(name_slug)
  </code></pre>
  
  <p>But I am not certain how to tie it all together.  </p>