getEntry attempts a lookup with the argument as a primary key (commonly integer in dbp, but also frequently a tuple). If this fails, it assumes the argument is a name, and checks for a gettableID method for the specified table. If that method does not exist, getEntry returns None. If it does exist, gettableID usually raises DBNoData if there are no results.
What that means is that getEntry('File', 0) will raise DBNoData (assuming no file ID 0) but getEntry('Inspector', 0) will simply return None, because getInspectorID does not exist, but getFileID does.
This issue should be closed when the desired behavior (returning None or raising error) is defined and codebase is checked for consistency. Both approaches are used and tested, so unit tests passing should be adequate (shouldn't need more.)
getEntry
attempts a lookup with the argument as a primary key (commonly integer in dbp, but also frequently a tuple). If this fails, it assumes the argument is a name, and checks for a gettableID method for the specified table. If that method does not exist,getEntry
returnsNone
. If it does exist, gettableID usually raisesDBNoData
if there are no results.What that means is that
getEntry('File', 0)
will raiseDBNoData
(assuming no file ID 0) butgetEntry('Inspector', 0)
will simply returnNone
, becausegetInspectorID
does not exist, butgetFileID
does.Minimal example to reproduce issue:
Do this in the unit tests directory:
OS, Python version, and dependency version information:
Version of dbprocessing
Way off in a working branch
Closure condition
This issue should be closed when the desired behavior (returning
None
or raising error) is defined and codebase is checked for consistency. Both approaches are used and tested, so unit tests passing should be adequate (shouldn't need more.)