Created sql_worker.py and moved code from main.py to sql_worker.py