[dataimport] move some functions to a PGHelper class [reviewed]