migrating arcpy process_diff_v2.py to postgis process_diff_v2.sql