Neat! If you wanted to extend this more (string diffs, non-json encodings), a custom function would be the next logical step. In Python it might be:<p><pre><code> import sqlite3
def delta(*args):
ret = {}
for name, old, new in zip(args[::3], args[1::3], args[2::3]):
if old != new:
ret[name] = old
if ret:
return ret
db = sqlite3.connect(':memory:')
db.create_function('delta1', delta, 3)
db.create_function('delta2', delta, 6)
db.create_function('delta3', delta, 9)
print db.execute('select delta2("b", "20", "20", "c", 3.4, 3.6)').fetchone()
>> (u'{"c": 3.4}',)</code></pre>