Select to view content in your preferred language

arcpy in Python 2 and branch versioning

2316
5
Jump to solution
08-11-2021 03:07 AM
kamil_szyc
Emerging Contributor

Hello,
I want to ask about branch versioning support in geodatabase connections.
I tried to use arcpy CreateDatabaseConnection function from Python 2 included with ArcGIS Server 10.8.

ArcMap 10.8 documentation states that version_type parameter supports value BRANCH, allowing to use branch versioning.
https://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/create-database-connection...

Despite this, function throws error below when passed "BRANCH" as version_type.

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\ArcGIS\Server\ArcPy\arcpy\management.py", line 19862, in CreateDatabaseConnection
raise e
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000800: The value is not a member of TRANSACTIONAL | HISTORICAL | POINT_IN_TIME.
Failed to execute (CreateDatabaseConnection).


I am aware that ArcMap application doesn't support branch versioning and only ArcGIS Pro does.
But if this also applies to Python scripting, then toolboxes documentation is wrong and should be appropriately updated.

0 Kudos
1 Solution

Accepted Solutions
JustinMuise
Esri Contributor

Hello,

Unfortunately, creating branch versioning connections from ArcMap and Python 2 is not supported as you discovered. This is a bug in our documentation. I have logged a bug, and it will be resolved in a future release.

 

Thank you,

Justin

View solution in original post

0 Kudos
5 Replies
RPGIS
by
Frequent Contributor

I think that Python 2 does not support this kind of script since ArcMap utilizes the python 2 environment whereas the ArcPro utilizes the Python 3 environment. Have you tried opening the script using the Python 3(Pro version) environment?

You can do so by right clicking on the python script that you wish to open, specify the 'Edit With IDLE' ArcGIS Pro, and run the script in that environment.

Also, can you post a snippet of the code or the script so anyone in the community can help you identify where the issue lies.

kamil_szyc
Emerging Contributor

I haven't mentioned it, but yes, I tried the same method call in Python 3 (Pro) environment and it works.

I specifically want to use Python 2 because I want to call this method in quite large, existing geoprocessing service written in Python 2. And because of branch versioning mentioned in ArcMap's arcpy documentation I've thought that it's supported.
But it's not surprising that it's not, because ArcMap does not support branch versioning. Documentation is just misleading in that matter.

I guess the only option is to use Python 3 (Pro) for that task and probably migrate whole geoprocessing service.

0 Kudos
JustinMuise
Esri Contributor

Hello,

Unfortunately, creating branch versioning connections from ArcMap and Python 2 is not supported as you discovered. This is a bug in our documentation. I have logged a bug, and it will be resolved in a future release.

 

Thank you,

Justin

0 Kudos
kamil_szyc
Emerging Contributor

Thank you for the official confirmation

0 Kudos
JoeBorgione
MVP Emeritus

I guess the only option is to use Python 3 (Pro) for that task and probably migrate whole geoprocessing service.

This...

And...

Do yourself a favor and embrace ArcGIS Pro.  It's a tough change I know but if an old gray-hair such as myself can do it, anyone can. I haven't used ArcMap/ArcCatalog in almost two years and don't miss it one bit. 

That should just about do it....