Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is a table in ArcMap a layer or a tableview. I want to be able to feed a table into an UpdateCursor via a toolbox script. If my table has a definition query on it how do I check for that with python?

share|improve this question

A table is a table. Look at the Dataset properties docs. Here is a describe on a Excel sheet:

>>> import arcpy
>>> desc = arcpy.Describe("Sheet1$")
>>> print desc.datasetType

And here is how you get the definition query, again with a describe:

>>> desc = arcpy.Describe("Sheet1$")
>>> dq = desc.whereClause
>>> dq
u"`F2` = 'Downloaded data'"

EDIT: blah238 is correct:

>>> desc = arcpy.Describe("Sheet1$")
>>> print desc.dataType

So, evidently a table is seen as a File and not a Dataset? The help topic on File properties isn't very helpful.

share|improve this answer
This is incorrect actually. A standalone table in ArcMap's table of contents is actually a table view, just like a feature layer. You can reference them by name instead of full path, and they can have definition queries, as you demonstrated. Try desc.dataType and see what that says. – blah238 Mar 2 '12 at 2:33
Regarding your latest edit: A dataset is a broad term that can include many data types (see the list on the help page for it). The .xls file itself is described as a File, but the worksheets within are Tables, and when you add them to your ArcMap TOC, they become Table Views. Since an Excel workbook (.xls or .xlsx file) can contain many tables, I like to think of them as file-based databases. The way you specify the full path to an Excel worksheet is <path to .xls file>\<sheet name>$ – blah238 Jun 22 '12 at 1:46

Thanks @blah238. I found this arcpy.mapping.ListTableViews(mxd, "", df): which is what I was looking for here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.