Using partial for getting filepaths
Taking advantage of psycopg2's cursor's execute functions, thanks @adamrp\!