Update data_to_db.py

unified the 2 functions in order to have the db available all the time