Use slave session for some select queries.
Use try-except-finally for slave sesssion.
Fix broken query