dynamically evaluated table_name in sql query on cache miss