Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python3/11_File_Operations/07_db_files/d_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())


Expand Down
6 changes: 3 additions & 3 deletions python3/11_File_Operations/07_db_files/f_delete_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
7 changes: 2 additions & 5 deletions python3/Projects/Arc_Listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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()

Expand Down
Loading