One comment here is that setting up the regular expressions for every sql statement is going to be expensive. It'd be better to cache the regular expressions once the list of `whitelisted_tables` is known.