Alter Version (Data Management)

Summary

Alters the properties of a geodatabase version.

Usage

  • Versioning tools only work with enterprise geodatabase data. File geodatabases do not support versioning.

  • Versions are not affected by changes occurring in other versions of the geodatabase.

  • This tool supports altering branch versions through the version service.

  • The properties of a branch version, including the version name, access, and target owner, can be altered when the input workspace is a database connection file connected as the geodatabase administrator. However, the version description can only be altered by the version owner.

Syntax

AlterVersion(in_workspace, in_version, {name}, {description}, {access}, {target_owner})
ParameterExplanationData Type
in_workspace

The database connection file to the enterprise, workgroup, or desktop geodatabase where the version to be altered is located. The default is to use the workspace defined in the Current Workspace environment.

For branch versioning, use a feature service URL (that is, https://mysite.mydomain/server/rest/services/ElectricNetwork/FeatureServer) or the feature layer portal item.

Workspace
in_version

The name of the version to be altered. If altering a branch version from a database connection connected as the geodatabase administrator, the version name must also include the service name, for example, myservice.versionowner.versionname.

String
name
(Optional)

The new name of the version.

String
description
(Optional)

The new description of the version.

String
access
(Optional)

Specifies the access permission for the version. If no value is specified, the access permission will not be updated.

  • PRIVATEOnly the owner can view the version and modify available feature classes.
  • PUBLICAny user can view the version and modify available feature classes.
  • PROTECTEDAny user can view the version, but only the owner can modify available feature classes.
String
target_owner
(Optional)

The name of the portal user to which the version ownership will be transferred. Ensure that the target owner user exists; the tool does not check the validity of the owner name specified. This parameter is only applicable for branch versions.

String

Derived Output

NameExplanationData Type
out_workspace

The updated workspace.

Workspace

Code sample

AlterVersion example 1 (stand-alone script)

The following stand-alone Python script uses the AlterVersion tool to alter a version.

# Description: Changes the name of a version

# Import system modules
import arcpy

# Set local variables
inWorkspace = "c:/ConnectionFiles/mygeodatabase@gdb.sde"
versionName = "myVersion"
newName = "myVersion2"

# Execute AlterVersion
arcpy.AlterVersion_management(inWorkspace, versionName, newName, "#", "PUBLIC")
AlterVersion example 2 (stand-alone script)

The following stand-alone Python script uses the AlterVersion tool to alter a branch version.

# Description: Changes the description of a version

# Import system modules
import arcpy

# Set local variables
inWorkspace = "https://myserver.mydomain.com/server/rest/services/MyService/FeatureServer"
versionName = "portaluser1.myVersion"
newDesc = "Ready for reconcile and post"

# Sign in to ArcGIS Enterprise
arcpy.SignInToPortal("https://myserver.mydomain.com/portal", 'portaluser1', 'my.password')

# Execute AlterVersion
arcpy.AlterVersion_management(inWorkspace, versionName, "", newDesc, "")

Environments

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics