diff --git a/python3/11_File_Operations/07_db_files/d_queries.py b/python3/11_File_Operations/07_db_files/d_queries.py index 94453a44..917e02b3 100644 --- a/python3/11_File_Operations/07_db_files/d_queries.py +++ b/python3/11_File_Operations/07_db_files/d_queries.py @@ -17,10 +17,10 @@ def select_all_records_by_author(cursor, author): def select_using_like(cursor, text): print("\nLIKE query results:\n") - sql = f""" + sql = """ SELECT * FROM books - WHERE title LIKE '{text}%'""" - cursor.execute(sql) + WHERE title LIKE ?""" + cursor.execute(sql, ('{0}%'.format(text), )) print(cursor.fetchall()) diff --git a/python3/11_File_Operations/07_db_files/f_delete_record.py b/python3/11_File_Operations/07_db_files/f_delete_record.py index e8f40758..6bbe42ac 100644 --- a/python3/11_File_Operations/07_db_files/f_delete_record.py +++ b/python3/11_File_Operations/07_db_files/f_delete_record.py @@ -5,11 +5,11 @@ def delete_author(author): conn = sqlite3.connect("books.db") cursor = conn.cursor() - sql = f""" + sql = """ DELETE FROM books - WHERE author = '{author}' + WHERE author = ? """ - cursor.execute(sql) + cursor.execute(sql, (author, )) conn.commit() diff --git a/python3/Projects/Arc_Listener.py b/python3/Projects/Arc_Listener.py index ee2105ed..9dd61f78 100644 --- a/python3/Projects/Arc_Listener.py +++ b/python3/Projects/Arc_Listener.py @@ -34,7 +34,6 @@ def video_report(self, report_json): upc = report_json["upc"] musicvideo_uuid = report_json["musicvideouuid"] isrc_dp_uuid = report_json["isrcdpuuid"] - folder = report_json["timestamp"] error_spec = report_json["error_spec"] strDataCapture = "Captured Data for video: " + upc + " and " + unique_key + "\n" @@ -45,10 +44,8 @@ def video_report(self, report_json): cursor = db.cursor() - sql = ( - f"select stateId from videos where upc = '{upc}' and isrc = '{unique_key}'" - ) - cursor.execute(sql) + sql = "select stateId from videos where upc = ? and isrc = ?" + cursor.execute(sql, (upc, unique_key, )) video = cursor.fetchall()