Put table and schema fetching in try statement