In order to add data to our SQLite database, we need to use an insert statement. We provide the insert statement with the name of the table we are updating and the values we wish to add to this table. We can then execute this as a query in the same way as before.
The insert syntax is as follows:
INSERT INTO table (column1, column2) VALUES (value1, value2);
So, for our users table, we could use the following:
INSERT INTO users (username, real_name) VALUES ("davidlove", "David Love");
Since we are going to be doing this from various flask endpoints, we should establish a method of doing this easily. To achieve this, make a file in your server folder, called database.py and add the following code:
import sqlite3 ...