Open
Description
I just got caught out by the fact that None
values are not processed by the .convert()
mechanism
sqlite-utils/sqlite_utils/db.py
Lines 2504 to 2510 in 0b7b80b
I had run this code while working on #420 and I wasn't sure why it didn't work:
$ sqlite-utils add-column content.db articles score float
$ sqlite-utils convert content.db articles score '
import random
random.seed(10)
def convert(value):
global random
return random.random()
'
The reason it didn't work is that the newly added score
column was full of null
values.
I fixed it by doing this instead:
$ sqlite-utils add-column content.db articles score float --not-null-default 1.0
But this indicates to me that the design of convert()
here may be incorrect.