title: unable to create autoincrementing primary key with flask-sqlalchemy
body: <p>I want my model's primary key to be an autoincrementing integer. Here is how my model looks like</p>
  
  <pre><code>class Region(db.Model):
      __tablename__ = 'regions'
      id = db.Column(db.Integer, primary_key=True, autoincrement=True)
      name = db.Column(db.String(100))
      parent_id = db.Column(db.Integer, db.ForeignKey('regions.id'))
      parent = db.relationship('Region', remote_side=id, primaryjoin=('Region.parent_id==Region.id'), backref='sub-regions')
      created_at = db.Column(db.DateTime, default=db.func.now())
      deleted_at = db.Column(db.DateTime)
  </code></pre>
  
  <p>The above code creates my table but does not make <code>id</code> autoincrementing. So if in my insert query I miss the <code>id</code> field it gives me this error </p>
  
  <blockquote>
    <p>ERROR:  null value in column "id" violates not-null constraint</p>
  </blockquote>
  
  <p>So I changed the <code>id</code> declaration to look like this</p>
  
  <pre><code>id = db.Column(db.Integer, db.Sequence('seq_reg_id', start=1, increment=1),
                 primary_key=True)
  </code></pre>
  
  <p>Still the same error. What is wrong with the code above?</p>