Split DB query into separate file