title: Python "InterfaceError: (sqlite3.InterfaceError) Error binding parameter 1 - probably unsupported type."
body: <p>I am trying to post to the database but I am getting a "sqlalchemy.exc.InterfaceError". I am using Flask/ flask_sqlalchemy extension. </p>
  
  <p><strong>Models.py</strong></p>
  
  <pre><code>class Link(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      original_url = db.Column(db.String(512))
      shorten_url = db.Column(db.String(14), unique=True)
      visits = db.Column(db.Integer, default=0)
      date_created = db.Column(db.DateTime, default=datetime.now)
  
      #  inheritance
      def __init__(self, **kwargs):
          super().__init__(**kwargs)
          self.shorten_url = self.create_short_link
  
      def create_short_link(self):
          characters = string.digits + string.ascii_letters 
          shorten_url = ''.join(choices(characters, k=3))
  
          link = self.query.filter_by(shorten_url=shorten_url).first()
  
          if link: 
             return self.create_short_link
  
          return shorten_url
  </code></pre>
  
  <p><strong>Routes.py</strong></p>
  
  <pre><code>@short.route('/add_link', methods=['POST'])
  def add_link():
          original_url = request.form['original_url']
          link = Link(original_url=original_url)
          db.session.add(link)
          db.session.commit()
  
          return render_template('link_added.html',
            new_link=link.shorten_url, original_url=link.original_url)
  </code></pre>
  
  <p><strong>Traceback</strong></p>
  
  <p>sqlalchemy.exc.InterfaceError: (sqlite3.InterfaceError) Error binding parameter 1 - probably unsupported type.
  [SQL: INSERT INTO link (original_url, shorten_url, visits, date_created) VALUES (?, ?, ?, ?)]</p>