V
V
vitHlJT62b7VCE22019-01-06 10:05:04
Python
vitHlJT62b7VCE2, 2019-01-06 10:05:04

Python and SQLite3. What is the problem?

I am writing a bot for Telegram, I am trying to add values ​​to the database

sql = 'INSERT INTO '+str(message.chat.id)+'_db (value1, value2, value3) VALUES (?, ?, ?);'
    cursor.execute(sql, (value1, value2, value3))
    conn.commit()

The sqlite3.OperationalError
: unrecognized token: "326883905_db" error pops up.
The database exists, in addition to these 3 parameters it has a primary key (id - I do not specify it when requesting).
What is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vitHlJT62b7VCE2, 2019-01-06
@vitHlJT62b7VCE2

Understood, it was necessary to quote the name of the table. I didn't see it in the examples.
The question is closed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question