ListVersions

Synthèse

Returns a list of versions that the connected user has permission to use.

Discussion

Specify the path to a connection file as an argument to the function, or set the workspace environment to the connection file and call the ListVersions function without arguments.

Remarque :

The arcpy.ListVersions function is different from the arcpy.da.ListVersions function, which returns a list of Version objects.

Syntaxe

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

An enterprise geodatabase workspace.

String
Valeur renvoyée
Type de donnéesExplication
String

A list of version names in the enterprise geodatabase that the connected user has permissions to use.

Exemple de code

ListVersions example

Get the list of versions the user has permissions to use and print 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)

Rubriques connexes