Open jsa-codes opened 2 years ago
def create_category(new_category): with sqlite3.connect("./db.sqlite3") as conn: conn.row_factory = sqlite3.Row db_cursor = conn.cursor() db_cursor.execute( """ INSERT INTO CATEGORIES (label) VALUES ( ? ); """, (new_category["label"]), ) id = db_cursor.lastrowid new_category["id"] = id return new_category
Created the following code: