Why SQLalchemy create_all() can be reused?
<p>I have very little background knowledge about database and SQLalchemy/sqlite3, but my experiment with these tells me that create_all() can be used almost like "initialize the database if it already exists".</p>

<p>Here is the "form submission" part of flask webapp I wrote:</p>

<pre><code>db = SQLAlchemy(app)
@app.route('/submit', methods=['POST'])
def submit():
    form = UserForm(request.form)
    if request.method == 'POST':
        new_entry = User(form.username.data,
                         form.password.data)
        db.create_all()
        add_entry(new_entry)
</code></pre>

<p>The <code>db.create_all()</code> should create a local <code>.db</code> file. If I already have that file, and I submit new data to the form, what happened is that the <code>new_entry</code> is appended to the database table instead of override that <code>.db</code> file. Can anyone confirm that this result is expected? And what is the better way to handle database initialization if this is poorly implemented?</p>