Dear all,
I have question regarding using arcpy to access to enterprice geodatabase. According to my research, the enterprice gdb is defined with a sde file on harddrive and I can just use the filepath of this sde as the workspace to access to this gdb. I have been doing this for a number of sql gdb and it works fine for me. The steps are as followings:
ws = "C:\\Users\\user\\AppData\\Roaming\\ESRI\\Desktop10.8\\ArcCatalog\\myGDB.sde"
layerPath = ws + "\\featureclassrName
desc = arcpy.dDescribe(layerPath)
gdb_df = pd.DataFrame.spatial.from_featureclass(layerPath)
However, I encountered an Enterprice gdb server that is not defined with sde, rather, it is defined with gds. For example, "C:\\Users\\user\\AppData\\Roaming\\ESRI\\Desktop10.8\\ArcCatalog\\myGDB.gds". If I use this file path for ArcPy, it will return "Cannot open file" msg.
So, my question is, how to access Enterprice Geodatabase Server define with *.gds file? Do I have to created Database Connection in ArcCatelog instead of Database Server?
Thanks a lot and have a nice weekend!
Ming
Solved! Go to Solution.
In the realm of ArcGIS, connecting to a 'Server' in catalog or Pro means connecting to an ArcGIS Server which is considered part of an enterprise. SDE is actually an outdated term as it has been replaced with Enterprise Geodatabase (EGDB).
If you are connecting to an EGDB, I suggest creating a connection file. Keep it somewhere and always refer to that path and file name in python.
import arcpy
arcpy.env.workspace = r'DriveLetter:\path\to\your\ConnectionFile.sde'
ws = arcpy.env.workspace
fc = f'{ws}\yourFeatureClassName'
Thanks to Joe and Nathan!
It seam that ArcPy access to EGDB via Database Connection (SDE file). Therefore, a connectionFile.sde has to be made either with ArcCatelog, or ArcTool, or command:
CreateArcSDEConnectionFile()
Thanks!
Ming
In the realm of ArcGIS, connecting to a 'Server' in catalog or Pro means connecting to an ArcGIS Server which is considered part of an enterprise. SDE is actually an outdated term as it has been replaced with Enterprise Geodatabase (EGDB).
If you are connecting to an EGDB, I suggest creating a connection file. Keep it somewhere and always refer to that path and file name in python.
import arcpy
arcpy.env.workspace = r'DriveLetter:\path\to\your\ConnectionFile.sde'
ws = arcpy.env.workspace
fc = f'{ws}\yourFeatureClassName'
Thanks Joe for your prompt reply! I will give a try next week.
Regarding "creating a connection file", do you mean create a database connection in ArcCatelog (this will create a connection.sde file), or, write a sde file by my self. If the later, can you share a link about how or a sample?
Ming
Hi Ming, I'm not very familiar with this subject, but apparently .gds files are used to store connection information to database servers. Check out the documentation here:
https://desktop.arcgis.com/en/arcmap/latest/manage-data/database-servers/overview-database-servers.h...
My first recommendation would be to try to open it in ArcCatalog. It probably behaves just like an .sde connection.
Check the online help here on connection files:
Thanks to Joe and Nathan!
It seam that ArcPy access to EGDB via Database Connection (SDE file). Therefore, a connectionFile.sde has to be made either with ArcCatelog, or ArcTool, or command:
CreateArcSDEConnectionFile()
Thanks!
Ming