i'm trying to make a simple query in python and sqlite3:
#!/usr/bin/env python
# -*- coding: utf-8; -*-
import sqlite3
db = sqlite3.connect('test.db')
query = """CREATE TABLE `home` (
`id` int(11) not null auto_increment,
`full_name` char(255) not null,
`display_name` char(255),
`ip_address` char(255) not null,
`user` char(255) not null,
PRIMARY KEY (`id`)
);"""
db.execute(query)
db.commit()
db.close()
But when i run the script, nothing happens; i mean: a file called test.db is created in the directory, but after that the shell remain there without return anything (even the prompt) and i need to kill the script with kill -9
Any help?
sqlite3.OperationalError: near "auto_increment": syntax errorexception instead. SQLite hasAUTOINCREMENTwithout an underscore. Even with that corrected, there are more syntax errors still, becauseAUTOINCREMENTcan only be used with aPRIMARY KEYcolumn.intworks just fine, but you probably don't want to use it if you can help it.charhasTEXTaffinity,intis mostly aligned withINTEGER.