title: Python Flask and SQLAlchemy, selecting all data from a column
body: <p>I am attempting to query all rows for a column called <code>show_id</code>. I would then like to compare each potential item to be added to the DB with the results. Now the simplest way I can think of doing that is by checking if each show is in the results. If so pass etc. However the results from the below snippet are returned as objects. So this check fails. </p>
  
  <p>Is there a better way to create the query to achieve this?</p>
  
  <pre><code>shows_inDB = Show.query.filter(Show.show_id).all()
  print(shows_inDB)
  </code></pre>
  
  <p>Results:</p>
  
  <pre><code>&lt;app.models.user.Show object at 0x10c2c5fd0&gt;, 
  &lt;app.models.user.Show object at 0x10c2da080&gt;, 
  &lt;app.models.user.Show object at 0x10c2da0f0&gt;
  </code></pre>
  
  <p>Code for the entire function:</p>
  
  <pre><code>def save_changes_show(show_details):
      """
      Save the changes to the database
      """  
      try:
          shows_inDB = Show.query.filter(Show.show_id).all()
          print(shows_inDB)
  
          for show in show_details:
  
              #Check the show isnt already in the DB
              if show['id'] in shows_inDB:
                  print(str(show['id']) + ' Already Present')
              else:
  
                  #Add show to DB
                  tv_show = Show(
                      show_id = show['id'],
                      seriesName = str(show['seriesName']).encode(),
                      aliases = str(show['aliases']).encode(),
                      banner = str(show['banner']).encode(),
                      seriesId = str(show['seriesId']).encode(),
                      status = str(show['status']).encode(),
                      firstAired = str(show['firstAired']).encode(),
                      network = str(show['network']).encode(),
                      networkId = str(show['networkId']).encode(),
                      runtime = str(show['runtime']).encode(),
                      genre = str(show['genre']).encode(),
                      overview = str(show['overview']).encode(),
                      lastUpdated = str(show['lastUpdated']).encode(),
                      airsDayOfWeek = str(show['airsDayOfWeek']).encode(),
                      airsTime = str(show['airsTime']).encode(),
                      rating = str(show['rating']).encode(),
                      imdbId = str(show['imdbId']).encode(),
                      zap2itId = str(show['zap2itId']).encode(),
                      added = str(show['added']).encode(),
                      addedBy = str(show['addedBy']).encode(),
                      siteRating = str(show['siteRating']).encode(),
                      siteRatingCount = str(show['siteRatingCount']).encode(),
                      slug = str(show['slug']).encode()
                  )
                  db.session.add(tv_show)
  
                  db.session.commit()
      except Exception:
          print(traceback.print_exc())
  </code></pre>