move database code to another py script