I am writing a python script to search if an element pre-exists in my sql database.
def create_connection(db_file):
try:
conn = sqlite3.connect(db_file)
print(sqlite3.version)
except Error as e:
print(e)
main(conn) #function with inserts creates table and inserts values and calls find_values() function
def find_values(conn):
sql = ''' SELECT link_ID from links_table where link_ID="l_1234" '''
conn.execute(sql)
conn.commit()
Here I am comparing to something which I have already entered in my code like "l_1234". How will I compare it to something which is dynamic like a user entered variable? Also how will I find if the element was found?