SQLite3 Python Errors

Содержание
Введение
sqlite3.OperationalError: table t already exists
sqlite3.OperationalError: near "-": syntax error
sqlite3.OperationalError: 2 values for 4 columns
Похожие статьи

Введение

sqlite3.OperationalError: table t already exists

Если при запуске скрипта, который создаёт базу данных, вы получили

Traceback (most recent call last): File "C:\Users\Andrei\PycharmProjects\from_csv.py", line 5, in <module> cur.execute("""CREATE TABLE t ( sqlite3.OperationalError: table t already exists

Скорее всего, вы уже запускали этот скрипт, и он уже создал базу данныйх с таблицей.

Как вариант - найдите базу данных и удалите/переименуйте её.

sqlite3.OperationalError: near "-": syntax error

Какой-то столбец содержит "-" и sqlite3 не может это переварить.

Замените на "_"

sqlite3.OperationalError: 2 values for 4 columns

Значит не хватает знаков вопроса - добавьте 2

VALUES (?, ?)

Замените на

VALUES (?, ?, ?, ?)

Article author: Andrei Olegovich

Похожие статьи
SQLite3 Python
Реальный пример
Ошибки
Python
Базы данных

Search this site

Subscribe to Telegram channel @aofeed to follow new articles and updates to old ones

Go to channel

@aofeed

Ask a question in the Telegram group

@aofeedchat

Contacts and cooperation:
I recommend our hosting beget.ru
Write to info@urn.su, info@aredel.com if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: