error: no such table UNABLE TO CREATE DB
Question: i am trying to run a database and make entries into it using the following
code to run the database. even though i make proper entries, i still get an
error "no such table: user"

    
    
    from flask import Flask, request, flash, url_for, redirect
    from flask.ext.sqlalchemy import SQLAlchemy
    from spello import app
    from datetime import datetime
    
    app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///spello.db'
    db = SQLAlchemy(app)
    
    
    app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///spello.db'
    db = SQLAlchemy(app)
    
    class User(db.Model):
    
        id = db.Column(db.Integer , primary_key = True)  #defines the id
        email = db.Column(db.String(90))  #defines the Developer's email ID
        URL = db.Column(db.String(120)) #defines the URL
    
        # created_on = db.Column(db.DateTime)
    
        def __init__(self, email, URL):
            self.email = email
            self.URL = URL
    
        # self.creation = datetime.now()
    
        def __repr__(self):
            return "<User %r>" % self.email
    

i open python in the command line and type the following codes

    
    
    >>> from spello import models
    >>> from spello.models import db,User
    >>> db.create_all()
    >>> u = User('a@b.com','www.asd.com')
    >>> db.session.add(u)
    >>> db.session.commit()
    

but i when i run sqlite3 in the commandline to check if the database is
created, i get the following error

    
    
    (spello)$ sqlite3
    sqlite> select * from user;
    Error: no such table: user
    

can please sm1 tell where i m going wrong??


Answer: What a recent version of the `sqlite3` tool actually says is:

    
    
    $ sqlite3
    SQLite version 3.8.4.3 2014-04-03 16:53:12
    Enter ".help" for usage hints.
    Connected to a transient in-memory database.
    Use ".open FILENAME" to reopen on a persistent database.
    sqlite>
    

To open your database, you must actually open it:

    
    
    $ sqlite3 /wherever/you/have/put/spello.db
    

