near "qutoincrement": syntax error,这个错误怎么解决?


import sqlite3
from flask import Flask, request, session, g, redirect, url_for, \


 abort, render_template, flash

from contextlib import closing

configuration

DATABASE = 'flaskr.db'
DEBUG = True
SECRET_KEY = 'development key'
USERNAME = 'admin'
PASSWORD = 'default'

app = Flask(__name__)
app.config.from_object(__name__)
def connect_db():


 return sqlite3.connect(app.config['DATABASE'])

def init_db():


 with closing(connect_db()) as db:
    with app.open_resource('schema.sql') as f:
        db.cursor().executescript(f.read())
    initdb.commit()

if name == '__main__':


 app.run()

代码如图,没有错误。在powershell中出现这样的错误。

init_db()

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "flaskr.py", line 21, in init_db


 db.cursor().executescript(f.read())

sqlite3.OperationalError: near "qutoincrement": syntax error
谢谢。

python2.7 python-flask

BigMao 9 years, 5 months ago

贴一下schema.sql的内容,应该是autoincrement吧

hcd123 answered 9 years, 5 months ago

Your Answer