Resumen
Returns a list of versions that the connected user has permission to use.
Debate
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.
Nota:
The arcpy.ListVersions function is different from the arcpy.da.ListVersions function, which returns a list of Version objects.
Sintaxis
ListVersions (sde_workspace)
Parámetro | Explicación | Tipo de datos |
sde_workspace | An enterprise geodatabase workspace. | String |
Tipo de datos | Explicación |
String | A list of version names in the enterprise geodatabase that the connected user has permissions to use. |
Muestra de código
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)