It depends on the securities you have. Can you just reference the file system of your remote DB server? Have you referenced your remote DB on your application server?Have you gone through these steps? I'm assuming you are using SQL Server based on your naming.http://resources.arcgis.com/en/help/main/10.2/index.html#//015400000613000000
That is half correct. In your case you have created a sde connection file which is a recognized workspace type. Whether or not it actually references a valid database connection is irrelevant to the tool.Running an arcpy.ListFeatureClasses() on an invalid sde connection will return an empty list.
The script would surely error out if I tried to read featureclasses from something that is not a workspace.
Do this:sdeFC = r"<remote db server>\SDE_Connection.sde" for fc in arcpy.ListFeatureClasses(): print fc
sdeFC = r"<remote db server>\SDE_Connection.sde" for fc in arcpy.ListFeatureClasses(): print fc
What you reference was just an example of accessing a FeatureClass directly, just as you would from a FGDB, i.e. C:\FGDB.gdb\FeatureClass. When you do the same thing in SDE the path includes the DB connection file + the DB + the schema + the featureclass name.But that is all really irrelevant.I'm just trying to find a way to have python on one cloud server access an SDE instance on another cloud server, presumably using a connection file I can create on the non-SDE server.I created a connection file like this and tested it. It worked in the sense that it did not raise an error, but it also did not give me the result I was expecting.
sdeFC = r"<remote db server>\SDE_Connection.sde\DB.dbo.FeatureClass" for fc in arcpy.ListFeatureClasses(): print fc
I am unfamiliar with attempting to access items from a particular schema like you are "DB.sde\DB.dbo.FeatureClass". Have you tried to ListFeatureClasses() with just the .sde connection alone?
The code was just something benign like this. I run it from IDLE and it completes without raising an error, but also without printing any featureclass names. import arcpy sdeConn = r"<connection file>" ##this is the one that was created with arcpy.management.CreateDatabaseConnection arcpy.env.workspace = sdeConn for fc in arcpy.ListFeatureClasses(): print fc In the absence of try/except IDLE should raise any error.
import arcpy sdeConn = r"<connection file>" ##this is the one that was created with arcpy.management.CreateDatabaseConnection arcpy.env.workspace = sdeConn for fc in arcpy.ListFeatureClasses(): print fc
sdeFC = r"<remote db server>\SDE_Connection.sde"
To test it I set the connection file as a workspace and ran arcpy.ListFeatureClasses() against it. It did not raise any errors, but it also did not return any featureclasses that are in SDE.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.