how to connect to SDE version using stand alone python script

4355
4
11-28-2014 04:18 AM
TarunPunetha1
New Contributor II

How to connect a argis, sde version through stand alone python script. SDE.Mapping is child version of SDE.Default and I want to make child version of SDE.Mapping . I am using direct sde services, sde:oracle11g:dbname

I need to know command of python to connect to a sde version.

session connection.JPG

Tags (2)
0 Kudos
4 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Tarun,

You can do this using the Create Database Connection tool.  There is an optional parameter, version, where you can specify the database version.  Ex:

arcpy.CreateDatabaseConnection_management("Database Connections", "ORCL", "ORACLE", "SDESERVER", "DATABASE_AUTH", "vector", "vector", "SAVE_USERNAME", "#", "#", "TRANSACTIONAL", "VECTOR.Child1")

0 Kudos
TarunPunetha1
New Contributor II

Thanks Jake, it worked

0 Kudos
TarunPunetha1
New Contributor II

Jake, do you know

How  to start, stop and save edits in python script for arcmap version 10.0.

arcpy.da.editing is working for arcmap 10.1 version onwards

0 Kudos
RemiAmbattakathutt
New Contributor

Jake,

I am having a similar issue. I am trying to connect to a version other than DEFAULT by providing version parameter. But it is always connecting to DEFAULT version. Could you please provide any input on this? Here is the code i used

arcpy.CreateDatabaseConnection_management(out_folder_path="Database Connections",

                                          out_name="creaconn5.sde",

                                           database_platform="ORACLE",

                                           instance="srv1/testgis",

                                          account_authentication="DATABASE_AUTH",

                                          username="sde",

                                          password="xxxx",

                                          save_user_pass="SAVE_USERNAME",

                                          version_type="TRANSACTIONAL",

                                          version="TEST.VERSION1")

In the immediate window right pane it shows as

Executing: CreateDatabaseConnection "Database Connections" creaconn5.sde ORACLE srv1/testgis DATABASE_AUTH sde ***** SAVE_USERNAME # SDE TRANSACTIONAL # #

You can observe that, even though I specified version parameter, it took it as blank (#)

Could you help in identifying what went wrong?

0 Kudos