title: Flask and SQLAlchemy db.session.commit not working
body: <p>When I add a test user to the <code>User</code> table, it adds fine and it is fine even when I execute <code>db.session.add(u)</code>, but it throws error when I execute <code>db.session.commit()</code>.</p>
  
  <pre><code>from app import db
  
  class User(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      name = db.Column(db.Integer(120), unique=True)
      email = db.Column(db.Integer(120), unique=True)
      configkey = db.Column(db.Integer(200), unique=True)
      dob = db.Column(db.DateTime)
      country = db.Column(db.Integer(120))
      friends = db.relationship('Friend', backref = 'friendof', lazy = 'dynamic')
  
  
      def __repr__(self):
          return '&lt;User %r&gt;' % (self.name)
  
  class Friend(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      name = db.Column(db.Integer(120), unique=True)
      email = db.Column(db.Integer(120), unique=True)
      dob = db.Column(db.DateTime)
      country = db.Column(db.Integer(120))
      lastmessage = db.Column(db.Integer(1500))
      user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
  
  
      def __repr__(self):
          return '&lt;FriendName %r&gt;' % (self.name)
  </code></pre>
  
  <p><strong>--Edit</strong>, including the error message in Python console:</p>
  
  <pre><code>&gt;&gt;&gt; u = models.User(name="sd", email="e")                                                                                                                      
  &gt;&gt;&gt; db.session.add(u)
  &gt;&gt;&gt; db.session.commit()
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/scoping.py", line 149, in do
      return getattr(self.registry(), name)(*args, **kwargs)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 721, in commit
      self.transaction.commit()
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 354, in commit
      self._prepare_impl()
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 334, in _prepare_impl
      self.session.flush()
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1818, in flush
      self._flush(objects)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1936, in _flush
      transaction.rollback(_capture_exception=True)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py", line 58, in __exit__
      compat.reraise(exc_type, exc_value, exc_tb)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1900, in _flush
      flush_context.execute()
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 372, in execute
      rec.execute(self)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 525, in execute
      uow
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 64, in save_obj
      table, insert)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 569, in _emit_insert_statements
      execute(statement, params)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 662, in execute
      params)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 761, in _execute_clauseelement
      compiled_sql, distilled_params
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 874, in _execute_context
      context)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1024, in _handle_dbapi_exception
      exc_info
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 196, in raise_from_cause
      reraise(type(exception), exception, tb=exc_tb)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 867, in _execute_context
      context)
    File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 324, in do_execute
      cursor.execute(statement, parameters)
  sqlalchemy.exc.OperationalError: (OperationalError) no such table: user u'INSERT INTO user (name, email, configkey, dob, country) VALUES (?, ?, ?, ?, ?)' ('sd'
  , 'e', None, None, None)
  </code></pre>