ListVersions

サマリー

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

説明

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.

注意:

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

構文

ListVersions (sde_workspace)
パラメーター説明データ タイプ
sde_workspace

An enterprise geodatabase workspace.

String
戻り値
データ タイプ説明
String

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

コードのサンプル

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)

関連トピック