Updated with simplified schema that gets the base table from the sample