In the ArcPy Mapping Module, please add the property named 'serviceProperties' to the TableView class. This property exists on the 'feature layer' class and allows ptyhon programmers like myself identify what server a particular SDE layer is coming from.
I am trying to write a Python tool to repoint all the sources in a particular MXD from one server to another. However the MXD contains layers and table views from multiple SDE's, I just want to repoint the data from one SDE(Like repointing data sources from a Test SDE to a production SDE).
The 'replacedatasource' method for repointing layers is insufficient, since it relies on me the programmer knowing what the path is to the SDE connection file used to add the table to the map. However, since I am just the programmer, I have no idea what the name of particular SDE connections users added data from. I'd rather just search each layer and tableview and check the service or server line to see if the name of a particular server is there. If it is I can run my code to repoint the layer to a different server.
Hi Everyone,
Anybody facing problem related to above query can use the workspacePath property of the tableview present in the MXD and further pass this path as a parameter to the describe method of arcpy(i.e arcpy.Describe(path)), which will return the object that has the connection properties, from where you can retrieve the server line and other stuffs related to the tableview connection. For more info about the object obtained follow:http://pro.arcgis.com/en/pro-app/arcpy/functions/workspace-properties.htm
Thanks for the tip, but my tableviews don't always have workspacePaths. Someone else was seeing that too on Stack Exchange: workspace - TableView has no workspacePath in ArcPy? - Geographic Information Systems Stack Exchange Anyone know why?
I know this thread is ancient but.... was this ever addressed? [TableView].connectionProperties just returns an empty string. Using Pro 2.9.5.
EDIT: Think i have this solved by using arcpy.Describe([TableView]). Then using Describe.path and Describe.baseName
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.