Don't rely on setdefault returning a value

Workaround a bug in sqlalchemy>=0.9.5 where setdefault doesn't return
the proper value.

Change-Id: Ibc93024f7f41f4ced81525fac42566a18b1c641c
Closes-Bug: #1333556