ListVersions (arcpy)

Récapitulatif

Lists the versions the connected user has permission to use.

Discussion

You can specify the path to an ArcSDE connection file as an argument to the function or you can set the workspace environment to the ArcSDE Connection file and call the ListVersions function without any arguments. Only those versions the connected user has permissions to use will be included in the list returned by the function.

RemarqueRemarque :

The arcpy.ListVersions function should not be confused with the arcpy.da.ListVersions function which is used to return a list of Version objects.

Syntaxe

ListVersions (sde_workspace)
ParamètreExplicationType de données
sde_workspace

An ArcSDE geodatabase workspace.

String
Valeur renvoyée
Type de donnéesExplication
String

The returned from the function containing version names in the ArcSDE geodatabase the connected user has permissions to use.

Exemple de code

ListVersions example

Gets the list of versions the user has permissions to use and prints them.

import arcpy

database = "Database Connections/toolboxDEFAULTVersion.sde"
versions = arcpy.ListVersions(database)

# Print the versions available to the user
for version in versions:
    print(version)

Thèmes connexes

4/26/2014