This patch adds selectOne and selectOneBy methods to
SQLObject, and simple test cases for them.
ForeignKey columns and alternateID columns are great,
but don't satisfy all use-cases. There are times when
you need to use select or selectBy, but you also know
that your query can only ever return one (or zero)
rows. An example is any time you have an UNIQUE
constraint on multiple columns, and you do a selectBy
on the same set of columns.
selectOne and selectOneBy are designed to make this
situation as easy to deal with as possible.
At Canonical, we've played with this for some time and
found it to be a very valuable addition to SQLObject,
eliminating a lot of boilerplate code.
Log in to post a comment.