This question has already been answered:
There are variables u_id and re_id with data.
And there is a table in the User database with branches: id , u_id and re_id .
It is necessary to prohibit adding duplicates, - when data with variables u_id and re_id already exist in the table
def add_rating(user_id, recipe_id, voice): conn = sqlite3.connect('db.sqlite') c = conn.cursor() c.execute("INSERT INTO User (u_id, re_id) VALUES("+ u_id +","+re_id+")") conn.commit() conn.close() check is required, not by a unique id, but by the input data, that is, to check the data in the u_id and re_id tables for uniqueness