Added dbgw.get_first_parent_of_type

Uses recursive cte :-)