title: Flask sqlalchemy - error binding parameter 0
body: <p>I'm learning to develop a web app with flask but now I'm stuck with this error using flask-sqlalchemy:</p>
  
  <pre><code>Original exception was: (InterfaceError) Error binding parameter 0 - probably unsupported type. 
  u'INSERT INTO standards (std_insumo_id, std_name_id, cantidad, viviendas) VALUES (?, ?, ?, ?)' (...)",))
  </code></pre>
  
  <p>These are my models</p>
  
  <pre><code>class Insumo(db.Model):
      __tablename__ = 'insumos'
      codigo = db.Column(db.Integer, primary_key=True)
      descripcion = db.Column(db.String(64), unique=True)
      um = db.Column(db.String(64))
  
  
  class StandardName(db.Model):
      __tablename__ = 'std_names'
      id = db.Column(db.Integer, primary_key=True)
      name = db.Column(db.String(64), unique=True)
      standards = db.relationship('Standard', backref='std_name')
  
  
  class Standard(db.Model):
      __tablename__ = 'standards'
      id = db.Column(db.Integer, primary_key=True)
      std_insumo_id = db.Column(db.Integer, db.ForeignKey('insumos.codigo'))
      std_name_id = db.Column(db.Integer, db.ForeignKey('std_names.id'))
      cantidad = db.Column(db.Float)
      viviendas = db.Column(db.Integer)
  </code></pre>
  
  <p>And this is what i'm doing when im trying to insert the row:</p>
  
  <pre><code>cemento = Insumo.query.filter_by(descripcion="Cemento").first()
  mamp = StandardName.query.filter_by(name="Mamposteria").first()
  </code></pre>
  
  <p>These two already exist in the db, so there is no problem. The problem arises when I'm trying to use model: Standard</p>
  
  <pre><code>r1 = Standard(std_insumo_id=cemento, std_name_id=mamp, cantidad=10, viviendas=40)
  db.session.add(r1)
  db.session.commit()
  </code></pre>
  
  <p>Could you help me understand what is happening? I don't see anything wrong with the types.</p>