title: How do I pass the result of a query to a variable (as a string) with SQLAlchemy?
body: <p>So I have an issue. I'm trying to verify if a password is valid for a simple Flask web application.</p>
  
  <p>Here's a simplified version of my code:</p>
  
  <pre><code>@app.route('/login', methods=['POST', 'GET'])
  def login():
  
      if request.method == 'POST':
  
          username = request.form['username']
          password = request.form['password']
  
      user_password = db.session.query(User.password).filter(User.username == username).first()
  
      if password != str(user_password):
          return "The password is invalid."
      else:
          return "Login successful."
  </code></pre>
  
  <p>But this doesn't work... It's always invalid and I think that I know why. The user_password query actually doesn't return the password as a string. If the password is Hello1234, it returns ('Hello1234',). What I need is for the user_password to just get the returned row as a string so that I can compare it with the user input.</p>
  
  <p>How can I do that?</p>