Answer the question
In order to leave comments, you need to log in
Parameters are not saved in sqlite3, what should I do?
Parameters are not saved in sqlite3, I'm doing everything right. HELP!
db = sqlite3.connect('database.db')
sql = db.cursor()
sql.execute("""CREATE TABLE IF NOT EXISTS users(
id INT
balance BIGINT
name TEXT)""")
db.commit()
user = vk_session.method("users.get", {"user_ids": id})
name = user[0]['first_name']
sql.execute(f"INSERT INTO users VALUES (?, ?, ?)", (id, 0, name))
db.commit()
Answer the question
In order to leave comments, you need to log in
Recreate database.db.
Something tells me that you have an old structure there, where there is only one column.
And yes, it doesn't hurt to create another column for the PRIMARY KEY.
sql.execute("""CREATE TABLE IF NOT EXISTS users(
id INT
balance BIGINT
name TEXT)""")
CREATE TABLE IF NOT EXISTS users(
id INT,
balance BIGINT,
name TEXT)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question