Select to view content in your preferred language

Add 'serviceProperties' property to the Arcpy TableView class

06-06-2012 02:29 PM
Status: Open
Labels (1)
Occasional Contributor III

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.

This would be a very helpful enhancement to the python library of functions.  I too am faced with resourcing layers and tableviews in 1000s of mxds.  I can access the existing properties of layers, but I can only guess at the existing properties of a tableview.

For now, I will just flag the instances of tableviews sources from SDE, which I will then need to manually update.  It would be far better, if this task could be done manually with python.
Totally agree. This idea is fundamental.
Why expose these properties for one data type and not another? Both being crucial forms within the ArcGIS paradigm.

With layers, I am able to dig further than the workspace path and interrogate the actual database connection properties to find:
  • The user connection to the database (tells me access privileges)
  • The database name
  • The database instance
With tables (table views) I am limited to interrogating the workspace path or dataset name. That’s it!! This is totally useless when it comes to systematically interrogating a bunch of map documents and their connections. In a lot of cases, the workspace path is a user’s catalog connection – C:\....\...\ so if I run from anything other than the map authors machine I can’t interrogate the connection any further.

The workspace connection is actually of no use either - its whatever the user who made the map has called the .sde file in their ArcCatalog folder. This tends to give no indication what the actual datasource is and even if they have followed some form of naming convention it cannot be handled with any sense of reliability.
The best you can do is find the dataset name, then interrogate each of your database instances to determine if the table exists – which it probably will do across all system life cycles – DEV, UAT, PROD etc.

When it comes to table views, you can’t actually determine (programmatically) any of the properties that are available when you manually check the datasource within ArcMap.

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: 


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