add a one_or_zero method
chadwhitacre opened this issue · 1 comments
chadwhitacre commented
Often you are fine with zero or one result but more than one would indicate a bug. Right now you can do:
try:
rec = db.one(QUERY)
except TooFew:
rec = None
if rec is None:
pass
else:
passBut it might be nicer to be able to do:
rec = db.one_or_zero(QUERY)
if rec is None:
pass
else:
passchadwhitacre commented
This would also be good because the try/except form doesn't account for cases where rowcount is -1.