Version access level via SQL

1718
3
Jump to solution
03-09-2016 06:17 AM
by Anonymous User
Not applicable


Dear all

How can I know, via SQL, the access level of a Version (Public, Private or Protected)? I took a look to the VERSIONS table but I can't figure how to obtain this info.

I want to replicate the same version structure in a new geodatabase and I would like to create dynamically the "CreateVersion_Management..." arcpy commands using the info. in the SDE GDB tables.

Thank you in advance

Jesús de Diego

0 Kudos
1 Solution

Accepted Solutions
ChristianWells
Esri Regular Contributor

The access level of the version is stored in the table's status column. To work with this column you would need to know a version that is public, private, protected so you can identify the status number for each.

System tables of a geodatabase in SQL Server—Help | ArcGIS for Desktop

versions.jpg

However, if you are planning on using CreateVersion_management, an easier approach would be to use the Data Access module to list the version objects. Then you can use the version access property.

ListVersions—Data Access module | ArcGIS for Desktop

Version—Data Access module | ArcGIS for Desktop

Sample:

import arcpy

oldgdb = 'Database Connections\old.sde'
newgdb = 'Database Connections\new.sde'

for ver in arcpy.da.ListVersions(oldgdb):
     arcpy.CreateVersion_management(newgdb, ver.parentVersionName, ver.name, ver.access)
    

View solution in original post

3 Replies
ChristianWells
Esri Regular Contributor

The access level of the version is stored in the table's status column. To work with this column you would need to know a version that is public, private, protected so you can identify the status number for each.

System tables of a geodatabase in SQL Server—Help | ArcGIS for Desktop

versions.jpg

However, if you are planning on using CreateVersion_management, an easier approach would be to use the Data Access module to list the version objects. Then you can use the version access property.

ListVersions—Data Access module | ArcGIS for Desktop

Version—Data Access module | ArcGIS for Desktop

Sample:

import arcpy

oldgdb = 'Database Connections\old.sde'
newgdb = 'Database Connections\new.sde'

for ver in arcpy.da.ListVersions(oldgdb):
     arcpy.CreateVersion_management(newgdb, ver.parentVersionName, ver.name, ver.access)
    
by Anonymous User
Not applicable

Hi Christian

Values in STATUS field in VERSIONS table change once a reconclie/post has been done:

However, arcpy version object works fine for me!

Thanks

Jesús de Diego

0 Kudos
ChristianWells
Esri Regular Contributor

Glad this worked for you!

0 Kudos