Not added record in SQLite, what is the reason?

Hello!
Trying to connect a table to program in Python, to using it to add data, but somehow the work is done without error, although the data are not added, here's the code snippet:

connection = sqlite3.connect('bd/teachers.db')
 teachers = connection.cursor()
 name = str(input('Name\n'))
 about = str(input('Description\n'))
 table = str(input('table\n'))
 ins = 'INSERT INTO {} VALUES(NULL,?,?,?)'.format(table)
print(ins)
 teachers.execute(ins, (name, about, des))


The table consists of 4 columns - int (id) and 3 text

P. S. id - autoincremented field, how can you ignore it when a record is added through the program?

Thanks in advance!
June 3rd 19 at 19:25
1 answer
June 3rd 19 at 19:27
Solution
First, you can specify which fields to insert
'INSERT INTO table_name (some_field, another_field) VALUES (?, ?)'

Second, the data is not saved in DB, if not to commit the transaction by calling method commit.
thank you! And to close access after you add the also need to close? - Judah25 commented on June 3rd 19 at 19:30
to block access? - samir39 commented on June 3rd 19 at 19:33
to close the connection and cursor - Judah25 commented on June 3rd 19 at 19:36
them we must not close after adding, when they are no longer needed. But Yes, in the end should be close. - samir39 commented on June 3rd 19 at 19:39

Find more questions by tags PythonSQLite