Select to view content in your preferred language addTable method of Map class doesn't work for .dbf table

12-11-2018 11:29 AM
New Contributor II

ArcGIS Pro 2.2

Python 3.6

I am trying to add a .dbf table from disk to an existing map in an ArcGIS Pro project. The addTable method of the Map class works with a file geodatabase table, but does not work with a .dbf table. I created a simple map and script tool to test this, and a python script tool with a single input parameter of type "Table"

Here is the python script:

#script tool for testing addTable
theTable = arcpy.GetParameterAsText(0)

theProject ="CURRENT")

theMap = theProject.listMaps()[0]    

#now add table to map - use table function of mp to create a table object
# then use addTable method of map to add the table
theSumTab =

When I test this script tool by navigating to a file geodatabase table everything works:

When I test this script tool by navigating to a .dbf table it fails:

Do I need to do something differently in order for this to work with a .dbf table? Or does addTable just not have that functionality. It doesn't specify that in the help: 

Thanks for any input.

Sheila Churchill

0 Kudos
4 Replies
MVP Emeritus

you might want to check for the dbase instance

dBase Table properties—ArcPy Functions | ArcGIS Desktop 

copy rows supports dbase

Copy Rows—Data Management toolbox | ArcGIS Desktop and


Table To Table—Conversion toolbox | ArcGIS Desktop 

List tables provides the list

Map—ArcPy | ArcGIS Desktop 

if they exist in the map

Table—ArcPy | ArcGIS Desktop 

So I would make a featureclass table from the dbf if you want shorten what needs to be cheked, but the dbase table properties allows you to check for them

0 Kudos
New Contributor II

Thanks for replying Dan. I do not want to have to convert the .dbf table to a file geodatabase table, which is what copy rows or table to table does. If the .dbf table has already been added to the map manually, listTables will return it in the list.  I did try your suggestion of the Describe function to look at the table properties. However, that made me realize my script is failing when I use the Table function of, not the addTable method of the map. So I am not able to use the Table function of to create a table object from the string holding the table data source  as it outlines in the help ( Table—ArcPy | ArcGIS Desktop ). Perhaps the string that represents the data source of the .dbf table needs to be in a different format - I have encountered issues with coverages and ArcGIS Pro, maybe there are issues with dbf tables associated with shapefiles too.

0 Kudos
MVP Emeritus

Worth a check... the describe property for the dbf is quite specific.  The string representing the dbf would just have to include its file extension, it wouldn't matter if it was part of a shapefile

0 Kudos
New Contributor

I was having the same issue while trying to add a dbf table using the addTable method (m.addTable(tbl)). Using the addDataFromPath (data_path) method worked for me. : addDataFromPath. 

0 Kudos