title: SQLAlchemy how to insert base64 string in a column
body: <p>I've a problem when try to insert a base64 string in the database of the server. The data is received correctly from the client.</p>
  
  <p>This is the table:</p>
  
  <pre><code>from app import db
  
  class Example(db.Model):
      __tablename__ = 'example'
      id = db.Column(db.Integer, primary_key=True, autoincrement=True)
      image = db.Column(db.LargeBinary)
      description = db.Column(db.String(120))
  </code></pre>
  
  <p>And when I receive the data I try to insert by this way.</p>
  
  <pre><code>example.image = request.json['image']
  </code></pre>
  
  <p>But launch this error:</p>
  
  <pre><code>sqlalchemy.exc.StatementError: (builtins.TypeError) memoryview: a bytes-like object is required, not 'str' [SQL: 'INSERT INTO example (image, description) VALUES (?, ?)'] [parameters: [{'image':''iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAgAElEQVR4Xkyd65Ikx5GdI+9ZWVXdMwOQMtPF9EM/dDEtd0GQS4LgLk2m938KmWklApjprlveM/V9XsM1cUURmOmuyozwcD9+/LhH9 ... (131066 characters truncated) ... U+bq1fYzK8CjL+Htr9jmjGZaL/sAccUiPf8/8906GpLwkQngOCuh5nohrdndHTRHii8Q55Rlk2N1B1ZGCCmSIct5gm/IiAAAAEklEQVSsvzbg3YTp3ut72d+/AvI8T5jSrxmzAAAAAElFTkSuQmCC'','description':'Example description'}]]
  </code></pre>
  
  <p>Any solution for this?</p>