S
S
SISER1232021-03-30 20:54:56
Python
SISER123, 2021-03-30 20:54:56

What is the gist of sqlite3 python error?

Hello, I'm learning to work with databases through python, so I'm a beginner. I did everything the same as in the tutorial, but an error is generated: the table is not created. With all this, the database is in the same folder as the python code. I would be grateful if you point out my mistakes and, if possible, give an example of a competent code.

import sqlite3

with sqlite3.connect('bot.db') as db:
    sql = db.cursor()
    sql.execute("""INSERT INTO users(chat_id, username, full_name) VALUES (?, ?, ?)""", (12312, 'lol', 'Иван Иванов'))
    db.commit()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-03-30
@SoreMix

Some strange tutorial you have, in which the step with creating a table is skipped. You need to create it initially

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question