ArcSDE connection on the fly Python

Idea created by carrierkh on Dec 30, 2013
    New
    Score90
    • moodye
    • 1_ldmitruk
    • carrierkh
    • snoakes
    • astoffel
    • 1_rteniere
    • dan_odonohue
    • nealm
    • karisecrest
    I would like to purpose the ability to create connections to ArcSDE on the fly via Python.

    As it is now a *.sde connection file has to be created on disk in order to connect to ArcSDE via Python.

    What I am purposing is allowing us the ability to create connections to ArcSDE without needing to create a file. Possibly creating the connection in memory or allowing the connection information to persist in memory while the script is running.

    I have seen situations where a network drive gets disconnected, a connection file is moved, deleted, or renamed.

    If your script depends on these files and something happens to them it is not the end of the world to recreate them and get everything working again, but if we could handle this all in script and not have to write information to disk then it would help alleviate some of the aforementioned situations.

    Something like this would be helpful; Notice the first parameter is not a folder.

         Workspace = arcpy.CreateDatabaseConnection_management("in_memory", "GISADMIN.sde","SQL_SERVER","GISDB","DATABASE_AUTH","GISADMIN","password","SAVE_USERNAME","GIS")

         print arcpy.GetMessages()