示例#1
0
def reconcilePost(sdeDefault, versionName, defaultVersion):
    # reconcile and post a version
    addMessageLocal("Reconcile and Post Version... ")

    if versionName.split(".")[0] == versionName:
        # default to DBO
        versionName = "DBO." + versionName
    retcode = False

    addMessageLocal("Reconciling " + versionName + "...")
    try:
        retcode = arcpy.ReconcileVersion_management(
            sdeDefault, versionName, defaultVersion, "BY_OBJECT",
            "FAVOR_TARGET_VERSION", "LOCK_ACQUIRED", "NO_ABORT", "POST")
        if str(retcode) == sdeDefault:
            retcode = True
        else:
            addMessageLocal("Unexpected result: " + str(retcode) +
                            ", continuing...")
            retcode = True
    except:
        addMessageLocal("Reconcile failed: \n" + str(retcode) + "\n" +
                        sdeDefault)
        retcode = False
    arcpy.env.workspace = sdeDefault
    arcpy.ClearWorkspaceCache_management(sdeDefault)
    return retcode
def main():
    try:
        import time
        print "Started at " + time.strftime("%Y/%m/%d %H.%M.%S",
                                            time.localtime())
        xFlag = 0
        import arcpy, os, sys, shutil

        # Get parameters from config file
        sys.path.append(
            "//ccgisfiles01m/gisdata/prdba/crupdates/CCPythonLib/Appl/")
        import getConfig
        dbPrConn = getConfig.main('user', 'crscl', 'path', 'sclAdmin')

        # Reconcile and Post Final to Admin
        xStep = 'reconcile and post final to admin'
        arcpy.ReconcileVersion_management(dbPrConn, "SCLFINAL.Final",
                                          "SCLADMIN.Admin", "BY_OBJECT",
                                          "FAVOR_TARGET_VERSION",
                                          "LOCK_ACQUIRED", "ABORT_CONFLICTS",
                                          "POST")

        # Reconcile and Post Admin to Default
        xStep = 'reconcile and post admin to default'
        arcpy.ReconcileVersion_management(dbPrConn, "SCLADMIN.Admin",
                                          "sde.DEFAULT", "BY_OBJECT",
                                          "FAVOR_TARGET_VERSION",
                                          "LOCK_ACQUIRED", "ABORT_CONFLICTS",
                                          "POST")

        # Compress database
        xStep = 'compress database'
        arcpy.Compress_management(dbPrConn)
        print "\nCompleted at " + time.strftime("%Y/%m/%d %H.%M.%S",
                                                time.localtime())

    except:
        xFlag = 1
        ex = sys.exc_info()[1]
        eMsg = ex.args[0]
        xStep = '{0}: {1}'.format(xStep, eMsg)
        print 'Error at the following process: {0}'.format(xStep)

    finally:
        return (xStep, xFlag)
示例#3
0
def Post(SDE_DEFAULT, version, p):
    arcpy.env.workspace = SDE_DEFAULT
    parent = p

    arcpy.ReconcileVersion_management(SDE_DEFAULT, version, parent,
                                      "BY_ATTRIBUTE", "FAVOR_TARGET_VERSION",
                                      "LOCK_ACQUIRED", "NO_ABORT")

    arcpy.AddMessage("Post to SDE complete.")
    print "Post to SDE complete."
示例#4
0
def reconcile_prod():
	logging.info("Begin reconcile prod")
	try:
		logging.debug("Reconciling data from Production Edit version to production DEFAULT")
		arcpy.ReconcileVersion_management(production_edit_workspace, prod_edit_version, "dbo.DEFAULT", "BY_OBJECT", "FAVOR_TARGET_VERSION", "NO_LOCK_AQUIRED", "NO_ABORT", "POST")
		logging.debug("Finished reconciling data from Production Edit version to production DEFAULT")
		return True
	except arcpy.ExecuteError:
		msgs = arcpy.GetMessages(2)
		arcpy.AddError(msgs)
		logging.error("ArcGIS error: %s", msgs)
	except Exception as e:
		msg = e.message
		arcpy.AddError(msg)
		logging.error("Python error: %s", msg)
	logging.info("End reconcile prod")
	return False;
示例#5
0
def reconcile_staging():
    logging.info("Begin reconcile staging")
    try:
        logging.debug("Reconciling data from staging GIS to staging DEFAULT")
        arcpy.ReconcileVersion_management(staging_workspace,
                                          staging_edit_version, "dbo.DEFAULT",
                                          "BY_OBJECT", "FAVOR_EDIT_VERSION",
                                          "NO_LOCK_AQUIRED", "NO_ABORT",
                                          "POST")
        logging.debug(
            "Finished reconciling data from staging GIS to staging DEFAULT")
    except arcpy.ExecuteError:
        msgs = arcpy.GetMessages(2)
        arcpy.AddError(msgs)
        logging.error("ArcGIS error: %s", msgs)
    except Exception as e:
        msg = e.message
        arcpy.AddError(msg)
        logging.error("Python error: %s", msg)
    logging.info("End reconcile staging")
    return