Delete Version (Data Management)

Summary

Deletes the specified version from the input enterprise geodatabase.

Usage

  • Traditional versioning—The version owner or the geodatabase administrator can delete a traditional version. For more information, see Delete a traditional version.

  • Branch versioning—The version owner or the version administrator for the web feature layer can delete a branch version. For more information, see Delete a branch version.

  • 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 geodatabase containing the version to be deleted.

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

You can also delete a branch version using a database connection file (connected to a branch versioned workspace) when connected as the geodatabase admin user.

Workspace
Version Name

The name of the version to be deleted.

For branch versioning, if the input workspace is a database connection file, the name of the branch version to delete should be fully qualified (for example, servicename.portaluser.versionname). If the input workspace is a feature service URL, the name of the branch version to delete should not include the service name (for example, portaluser.versionname).

String

Derived Output

LabelExplanationData Type
Updated Geodatabase

The updated input workspace.

Workspace

arcpy.management.DeleteVersion(in_workspace, version_name)
NameExplanationData Type
in_workspace

The database connection file to the enterprise geodatabase containing the version to be deleted.

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

You can also delete a branch version using a database connection file (connected to a branch versioned workspace) when connected as the geodatabase admin user.

Workspace
version_name

The name of the version to be deleted.

For branch versioning, if the input workspace is a database connection file, the name of the branch version to delete should be fully qualified (for example, servicename.portaluser.versionname). If the input workspace is a feature service URL, the name of the branch version to delete should not include the service name (for example, portaluser.versionname).

String

Derived Output

NameExplanationData Type
out_workspace

The updated input workspace.

Workspace

Code sample

DeleteVersion example 1 (stand-alone script)

The following stand-alone script demonstrates how use the DeleteVersion function to delete a traditional version.

# Description: Deletes a version

# Import system modules
import arcpy

# Set local variables
inWorkspace = "c:/Connections/whistler@gdb.sde"
versionName = "myVersion2"

# Run DeleteVersion
arcpy.management.DeleteVersion(inWorkspace, versionName)
DeleteVersion example 2 (stand-alone script)

The following stand-alone script demonstrates how use the DeleteVersion function to delete a branch version as the geodatabase administrator.

# Description: Deletes a branch version

# Import system modules
import arcpy

# Set local variables
inWorkspace = "c:/project_path/SQL_SERV.sde"
versionName = "BuildingService.portaluser.Viewer"

# Run DeleteVersion
arcpy.management.DeleteVersion(inWorkspace, versionName)
DeleteVersion example 3 (stand-alone script)

The following stand-alone script demonstrates how use the DeleteVersion function to delete a branch version using a feature service URL.

# Description: Deletes a branch version

# Import system modules
import arcpy

# Set local variables
inWorkspace = "https://myserver.mydomain.com/server/rest/services/MyService/FeatureServer"
versionName = "PORTALUSER1.newversion2"

# Run DeleteVersion
arcpy.management.DeleteVersion(inWorkspace, versionName)

Environments

Licensing information

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

Related topics