@Forraz

Как решить ошибку sqlite Incorrect number of bindings supplied?

Код:
cur.execute(f"INSERT INTO {ds_name} (user) VALUES (?)",  username)


Ошибка:
Ignoring exception in command warn:
Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 172, in wrapped
    ret = await coro(*args, **kwargs)
  File "<string>", line 46, in warn
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 11 supplied.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/disnake/ext/commands/bot_base.py", line 578, in invoke
    await ctx.command.invoke(ctx)
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 914, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 181, in wrapped
    raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 11 supplied.
  • Вопрос задан
  • 88 просмотров
Решения вопроса 1
AlexNest
@AlexNest Куратор тега Python
Работаю с Python/Django
Вторым параметром execute должен быть кортеж, о чем, кстати, сказано в доках.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
19 апр. 2024, в 03:52
1000 руб./за проект
19 апр. 2024, в 03:01
1000 руб./за проект
18 апр. 2024, в 21:56
2000 руб./за проект