#!/usr/bin/python
import sqlite3
conn = sqlite3.connect('deleteme.sqlite')
# Create custom function in order to handle non-ASCII case-insensitive LIKE
conn.create_function('custom_upper', 1, lambda x: x.upper() if x else x)
###
### Assume that the connection to the sqlite3 database has been created and is valid ###
###
def find_videos_containing_title_string(conn, searchString):
curs = conn.cursor()
# Complete below
query = 'SELECT id, title FROM videos WHERE custom_upper(title) LIKE custom_upper(?)'
params = (f'%{searchString}%',)
curs.execute(query, params)
return curs.fetchall()
if __name__ == '__main__':
print(find_videos_containing_title_string(conn, 'über')) # Finds both "Übergröße" and "überschreitet"