We just moved a table over to branch versioning as our test case, and I'm trying to update a script that we used to edit values in this table. It looks like I need to use the Python API. I'm finding the feature service using content.search() and trying to pull up the tables using the tables property of the feature service item. However, it doesn't return any tables. The layers property returns a list of layers. I can see the table if I look at the REST endpoint, but not in the Python API.
My question is: Are there any alternative paths to getting to this table? For example, can I open the table object using its REST URL? Also, anyone have any ideas as to why the table isn't showing up in the search?
Bonus question: Can tables in feature services work with SearchCursors and UpdateCursors? Or should I use a different approach to update individual rows?
Solved! Go to Solution.
What specific code have you tried so far? Getting the service with gis.content.get('itemID') is more reliable than using the search, and you have to make sure you use the feature service's .tables property to specifically get the non-spatial tables from it.
EDIT: Sorry, you already specified you used the tables property. What comes in via the layers property? What kind of service is it?
Also, when we work with our branch versioned services via the Python API, we have better luck using the FeatureLayerCollection(url) method, though it ought to work just fine getting the layers/tables from the Item.
What specific code have you tried so far? Getting the service with gis.content.get('itemID') is more reliable than using the search, and you have to make sure you use the feature service's .tables property to specifically get the non-spatial tables from it.
EDIT: Sorry, you already specified you used the tables property. What comes in via the layers property? What kind of service is it?
Also, when we work with our branch versioned services via the Python API, we have better luck using the FeatureLayerCollection(url) method, though it ought to work just fine getting the layers/tables from the Item.
@jcarlson When I check the layers property, all the layers show up. I just tried FeatureLayerCollection, and that has the tables. I think I'm on the right path now. Thanks!