Fix to use the table_name set in the model with set_table_name

The table name set in the model via the set_table_name is not working in the dynamic fetcher. The code has been changed to make this work.