Allow keys to be associated with types in DB API

See issue #8.