Код: Выделить всё
sql_statements = [
"""CREATE TABLE IF NOT EXISTS users (
user_id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL,
name TEXT NOT NULL,
password_hash TEXT NOT NULL,
status BOOLEAN NOT NULL DEFAULT FALSE,
admin BOOLEAN NOT NULL DEFAULT FALSE
);"""
]
with sqlite3.connect(database_filename) as db:
cursor = db.cursor()
for statement in sql_statements:
cursor.execute(statement)
db.commit()
Код: Выделить всё
File "/Users/elijahyajaman/memberize/app.py", line 14, in
cursor.execute(statement)
sqlite3.OperationalError: near "AUTOINCREMENT": syntax error
Подробнее здесь: https://stackoverflow.com/questions/790 ... ite-module
Мобильная версия