logo

SQLite UDF in Python

From my StackOverflow answer on the subject of parsing SQLite string dates: Python makes it pretty easy to add a user-defined function to a SQLite query. Let’s demonstrate this by populating a table full of text reprensentations of dates, and then use a simple Python UDF we write here called date_parse to attempt to parse the text date into a real date. First, we need to do some basic setup. Let’s do some standard Python imports firsts.
3 minutes to read