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.

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

  • License:
    When working with branch versioning in an ArcGIS Enterprise 11.2 or later deployment, organization members must be assigned a license for the ArcGIS Advanced Editing user type extension to use this tool.

Parameters

LabelExplanationData Type
Input Workspace

The database connection file to the enterprise, workgroup, or desktop geodatabase where the version to be altered is located.

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
Input 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
Version Name
(Optional)

The new name of the version.

String
Version Description
(Optional)

The new description of the version.

String
Access Permission
(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

LabelExplanationData Type
Updated Geodatabase

The updated workspace.

Workspace

arcpy.management.AlterVersion(in_workspace, in_version, {name}, {description}, {access}, {target_owner})
NameExplanationData 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"

# Run AlterVersion
arcpy.management.AlterVersion(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')

# Run AlterVersion
arcpy.management.AlterVersion(inWorkspace, versionName, "", newDesc, "")

Environments

Related topics