I'm trying to create a method which creates a table if not exists.
When I try to execute this method, it returns sqlite3.OperationalError: near "TEXT": syntax error
The method:
def create_table_if_exists(self):
self.conn.execute(
'CREATE TABLE IF NOT EXISTS products(NAME TEXT, URL TEXT, '
'ESHOP1 TEXT, CENA1 TEXT, DOPRAVA1 TEXT, STAV1 TEXT, '
'ESHOP2 TEXT, CENA2 TEXT, DOPRAVA2 TEXT, STAV2 TEXT, '
'ESHOP3 TEXT, CENA3 TEXT, DOPRAVA3 TEXT, STAV3 TEXT, '
'ESHOP4 TEXT, CENA4 TEXT, DOPRAVA4 TEXT, STAV4 TEXT, '
'ESHOP5 TEXT, CENA5 TEXT, DOPRAVA5 TEXT, STAV5 TEXT')
self.conn.commit()
Error:
'CREATE TABLE IF NOT EXISTS products(NAME TEXT, URL TEXT, '
sqlite3.OperationalError: near "TEXT": syntax error
I can't realize where could be the problem. Do you have any advices?
Aucun commentaire:
Enregistrer un commentaire