fix build when generated file does not exist
update table handling
implement query running