Guest User

Untitled

a guest
Nov 15th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. """ author: andrew tangeman
  2. description: script to experiment with gdb replicas
  3. """
  4. import arcpy
  5. from sannetlogger import SannetLogger
  6.  
  7.  
  8.  
  9. OUT_SCHEMA ="../TestOutputReplicaSchema.xml"
  10. OUT_SCHEMA_CHANGE ="../TestOutputReplicaChanges.xml"
  11.  
  12. CONFLICT_DETECTION ="BY_OBJECT"
  13. CONFLICT_POLICY ="IN_FAVOR_OF_GDB1"
  14. DIRECTION ="BOTH_DIRECTIONS"
  15. RECONCILE ="DO_NOT_RECONCILE"
  16.  
  17.  
  18. sanlog = SannetLogger(print_to_console=True)
  19.  
  20. arcpy.env.overwriteOutput = True
  21.  
  22. def refresh_schemas(geodatabase1, geodatabase2, in_replica, output_schema, output_schema_change):
  23.  
  24. arcpy.ExportReplicaSchema_management(geodatabase1, output_schema, in_replica)
  25. sanlog.log(arcpy.GetMessages())
  26.  
  27. result = arcpy.CompareReplicaSchema_management(geodatabase2, output_schema, output_schema_change)
  28. print("\n\nresult = " + result.getOutput(0) + "\n\n")
  29. sanlog.log(arcpy.GetMessages())
  30.  
  31. arcpy.ImportReplicaSchema_management(geodatabase2, output_schema_changes)
  32. sanlog.log(arcpy.GetMessages())
  33.  
  34.  
  35. if __name == "__main__":
  36. gdb1 =""
  37. gdb2 =""
  38. replica ="DBO.RoadsReplica"
  39.  
  40. try:
  41. refresh_schemas(gdb1, gdb2, replica, OUT_SCHEMA, output_schema_change)
  42. except Exception as ex:
  43. sanlog.log(arcpy.GetMessages())
  44. sanlog.log(str(ex))
  45.  
  46. try:
  47. arcpy.SynchronizeChanges_management(gdb1, replica, gdb2, DIRECTION, CONFLICT_POLICY, CONFLICT_DETECTION, RECONCILE)
  48. sanlog.log(arcpy.GetMessages())
  49. except Exception as ex:
  50. sanlog.log(str(ex))
Add Comment
Please, Sign In to add comment