title: How do I force Flask/SQLAlchemy to create a table?
body: <p>I'm using Flask with flask.ext.sqlalchemy for the first time. I'm getting an error telling me a table doesn't exist, but I thought the object relational setup would take care of that. Guess not. What am I missing in the following code?</p>
  
  <pre><code>from flask import Flask, request, url_for
  from flask.ext.sqlalchemy import SQLAlchemy
  
  app = Flask(__name__)
  app.secret_key = 'This is really unique and secret'
  
  db = SQLAlchemy(app)
  app.config['SQLALCHEMY_DATABASE_URI'] ='mysql://golfape:mypass@mysql.server/golfape$swarm'
  
  
  class Suggestion(db.Model):
      __tablename__ = 'suggestions'
      id   = db.Column(db.Integer, primary_key = True)
      name = db.Column(db.String(100))
  
      def __init__( self, name ):
          self.name = name
  
  @app.route('/')
  def get_suggestion():
      return """
          &lt;p&gt;What do you think swarm prediction could be applied to?&lt;/p&gt;
          &lt;form method = "POST" action="%s"&gt;
               &lt;input name="name" /&gt;
               &lt;input type="submit" value="Go!" /&gt;
           &lt;/form&gt;
           """ % (url_for('append_suggestion'),)
  
  
  @app.route('/suggestions', methods=['POST'] )
  def append_suggestion():
      name = request.form["name"]
      newSuggestion = Suggestion( name = name )
      db.session.add( newSuggestion )
      db.session.commit()
      return """
          &lt;p&gt;Thanks for suggesting %s&lt;/p&gt;
          &lt;p&gt;&lt;a href="%s"&gt;Back&lt;/a&gt;&lt;/p&gt;
          """ % (name, url_for('get_suggestion'))
  </code></pre>
  
  <p>Here is the error:</p>
  
  <p>File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
      raise errorclass, errorvalue
  ProgrammingError: (ProgrammingError) (1146, "Table 'golfape$swarm.suggestions' doesn't exist") 'INSERT INTO suggestions (name) VALUES (%s)' ('fishing',)</p>