I am trying to create a python script to catalog all items in our geodatabases and their configuration using arcpy.Describe. Currently there is no way to determine if a feature class, table, or other item is branch versioned. The closest thing is the '.isVersioned' property for datasets (link). However, this is just a boolean value. So if a dataset is versioned there is no way to return if it's configured for traditional versioning or branch versioning.
This is becoming important for us as we transition many of our geodatabase items into a ArcGIS Enterprise web services model for editing. It would be helpful to run a scan of all geodatabase items and return a table documenting which are not versioned, which are still traditional, and which are now branch to assist with our transition.
I guess the best way to add this information to Arcpy is to add a new property named "versionType" to the dataset object(link). If the dataset is versioned it would return the value "Branch" or "Traditional". And if the dataset isn't versioned then I guess this property could have a null value or just not be present at all on the object.
arcpy.Describe returns the dataset property isVersioned as boolean - the described dataset could be either fully versioned or move-to-base and there is no way to determine which, other than to open the property sheet of each table or feature class using ArcCatalog. Might need to create a property with a different name to avoid breaking scripts that currently use isVersioned and expect a True/False return.
This would be very good to have. We are in the process of automating creation of datasets and feature classes in Enterprise databases. For us to be able to automate the process we need to see which version type the dataset has.
Hello all,
This is still under consideration, however, in the meantime I want to point you to this response from one of our coworkers which may help you:
How to identify branch versioned feature classes f... - Esri Community
The relevant solution is copied here for convenience:
SQL access to enterprise geodatabase data—ArcMap | Documentation (arcgis.com)
Geodatabase system tables—ArcMap | Documentation (arcgis.com)
Example: Determine which datasets are versioned in a geodatabase—ArcMap | Documentation (arcgis.com)
SQL SERVER
SELECT *
FROM sde.GDB_ITEMS
GO
--Versioned
SELECT NAME AS "Versioned feature class", definition
FROM sde.GDB_ITEMS
WHERE Definition.exist('(/*/Versioned)[1]') = 1
AND Definition.value('(/*/Versioned)[1]', 'nvarchar(4)') = 'true'
GO
--Not Versioned
SELECT NAME AS "Versioned feature class", definition
FROM sde.GDB_ITEMS
WHERE
Definition.exist('(/*/Versioned)[1]') = 1
AND Definition.value('(/*/Versioned)[1]', 'nvarchar(4)') = 'false'
GO
--Branch Versioned
SELECT NAME AS "Versioned feature class", definition
FROM sde.GDB_ITEMS
WHERE
Definition.exist('(/*/Versioned)[1]') = 1
AND Definition.value('(/*/Versioned)[1]', 'nvarchar(4)') = 'true'
AND Definition.exist('(/*/IsBranch)[1]') = 1
AND Definition.value('(/*/IsBranch)[1]', 'nvarchar(4)') = 'true'
GO
--Traditional Versioning
SELECT NAME AS "Versioned feature class", definition
FROM sde.GDB_ITEMS
WHERE
Definition.exist('(/*/Versioned)[1]') = 1
AND Definition.value('(/*/Versioned)[1]', 'nvarchar(4)') = 'true'
AND Definition.exist('(/*/IsBranch)[1]') = 1
AND Definition.value('(/*/IsBranch)[1]', 'nvarchar(4)') = 'false'
GO
Note: The links provided in the solution are for ArcMap. These queries work with the Enterprise Geodatabase Repository Tables, which is completely independent from the ArcGIS Client - so this should work with ArcMap or Pro.
We're working on this! This status does not guarantee that the functionality will be in the next release, but development work has begun. Release cycles vary by product so make sure to check the product life cycle information to get an idea of when to expect the next release.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.