Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """ author: andrew tangeman
- description: script to experiment with gdb replicas
- """
- import arcpy
- from sannetlogger import SannetLogger
- OUT_SCHEMA ="../TestOutputReplicaSchema.xml"
- OUT_SCHEMA_CHANGE ="../TestOutputReplicaChanges.xml"
- CONFLICT_DETECTION ="BY_OBJECT"
- CONFLICT_POLICY ="IN_FAVOR_OF_GDB1"
- DIRECTION ="BOTH_DIRECTIONS"
- RECONCILE ="DO_NOT_RECONCILE"
- sanlog = SannetLogger(print_to_console=True)
- arcpy.env.overwriteOutput = True
- def refresh_schemas(geodatabase1, geodatabase2, in_replica, output_schema, output_schema_change):
- arcpy.ExportReplicaSchema_management(geodatabase1, output_schema, in_replica)
- sanlog.log(arcpy.GetMessages())
- result = arcpy.CompareReplicaSchema_management(geodatabase2, output_schema, output_schema_change)
- print("\n\nresult = " + result.getOutput(0) + "\n\n")
- sanlog.log(arcpy.GetMessages())
- arcpy.ImportReplicaSchema_management(geodatabase2, output_schema_changes)
- sanlog.log(arcpy.GetMessages())
- if __name == "__main__":
- gdb1 =""
- gdb2 =""
- replica ="DBO.RoadsReplica"
- try:
- refresh_schemas(gdb1, gdb2, replica, OUT_SCHEMA, output_schema_change)
- except Exception as ex:
- sanlog.log(arcpy.GetMessages())
- sanlog.log(str(ex))
- try:
- arcpy.SynchronizeChanges_management(gdb1, replica, gdb2, DIRECTION, CONFLICT_POLICY, CONFLICT_DETECTION, RECONCILE)
- sanlog.log(arcpy.GetMessages())
- except Exception as ex:
- sanlog.log(str(ex))
Add Comment
Please, Sign In to add comment