Receiving "No Such Table" error while trying to access existing MySQL database using Flask and SQLAlchemy
Question: **myapp.py**

    
    
    #!flask/bin/python
    from flask import Flask, request, jsonify
    from flask.ext.sqlalchemy import SQLAlchemy
    
    app = Flask(__name__)
    db = SQLAlchemy(app)
    
    app.config['SQLAlchemy_DATABASE_URI'] = 'mysql://root:root@localhost/linkmanager'
    
    class Link(db.Model):
        __tablename__ = 'link'
        id = db.Column(db.Integer, primary_key = True)
        title = db.Column(db.Text)
        url = db.Column(db.Text)
        type = db.Column(db.Integer)
        insert_date = db.Column(db.DateTime)
    
    @app.route('/links', methods=['GET'])
    def links():
        if request.method == 'GET':
            results = Link.query.limit(10).offset(0).all()
    
            json_results = []
            for result in results:
                d = {
                        'id': results.id,
                        'title': results.title,
                        'url': results.url,
                        'type': results.type,
                        'insert_date': results.insert_date
                    }
                json_results.append(d)
            return jsonify(items=json_results)
    
    if __name__ == '__main__':
        app.run(debug=True)
    

Error message when I try to access localhost:5000/links:

**sqlalchemy.exc.OperationalError OperationalError: (OperationalError) no such
table: link u'SELECT link.id AS link_id, link.title AS link_title, link.url AS
link_url, link.type AS link_type, link.insert_date AS link_insert_date \nFROM
link\n LIMIT ? OFFSET ?' (10, 0)**

I know that the table does exist because I set it up with phpAdmin and have
accessed it from the command line. I also tried connecting to it with Java and
was successful... I have no idea why this is not working! Thanks for the help.


Answer: Your setting name is wrong. Change

    
    
    app.config['SQLAlchemy_DATABASE_URI'] = 'mysql://root:root@localhost/linkmanager'
    

to

    
    
    app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:root@localhost/linkmanager'
    

