A utility library for hierarchical db queries