title: flask/sqlalchemy - OperationalError: (sqlite3.OperationalError) no such table
body: <p>I get the below error:</p>
  <pre><code>sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: s_amodel [SQL: 'INSERT INTO s_amodel
  </code></pre>
  <h2>My files
  forms.py</h2>
  <pre><code>from flask_wtf import Form
  class SAForm(Form):
  </code></pre>
  <hr />
  <h2>models.py</h2>
  <pre><code>from app.app_and_db import db 
  
  class SAmodel(db.Model):
      id = db.Column(db.Integer(), primary_key=True)
  </code></pre>
  <h2>views.py</h2>
  <pre><code>from app.app_and_db import app, db
  from app.sa.forms import SAForm
  from app.sa.models import SAmodel
  
  @sa_blueprint.route('/sa/new', methods=['GET','POST'])
  def new_sa():
  
          form = SAForm(request.form, SAmodel)
  
          if request.method=='POST' and form.validate():
              model = SAmodel()
              form.populate_obj(model)
              db.session.add(model)
              db.session.commit()
              return redirect(url_for(&quot;sa.home_page&quot;))
          return render_template(&quot;new_sa.html&quot;, form=form)
  </code></pre>
  <h2>config.py</h2>
  <pre><code>SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL', 'sqlite:///app.sqlite')
  </code></pre>
  <p>This is what I have. The app.sqlite is created but it is 0 bytes. When I submit something using new_sa() function, I get the above error. Also how is it getting the table name &quot;s_amodel&quot;?</p>
  <p>Any help would be greatly appreciated. Thanks a lot!</p>