# Appending rows to empty FeatureClass with ArcPy

My goal is to delete all rows in an existing feature class, then append new rows from a new shapefile... everything works except for the append. The table-view portion as the input is giving me the trouble. I am working in ArcGIS Desktop 10.5.1

I got all the code working fine except for the append, it produces this error:

Traceback (most recent call last):
File "C:\Users\jhead\Desktop\UpdateCursor_Append.py", line 30, in <module>
arcpy.Append_management(sourceView, emptyFC, 'TEST')
File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\management.py", line 4271, in Append
raise e
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000840: The value is not a Table View.
ERROR 000840: The value is not a Raster Layer.
Failed to execute (Append).


My code is below:

emptyFC = r"Database Connections\TEST ENVIRONMENT.sde\TEST_ENVIRONMENT.DBO.featureclass"

sourceSHP = r"path\to\file.shp"

sourceDBF = r"path\to\output\folder"
print 'Converting new parcels to DBASE'
arcpy.TableToDBASE_conversion(sourceSHP,sourceDBF)

print ' Converting was successfull!'

print 'creating temporary table view in memory...'
sourceDBF2 = r"path\to\file.dbf"
sourceView = arcpy.MakeTableView_management(sourceDBF2, "sourceView")

print ' Appending new rows to existing Feature Class...\n'

arcpy.Append_management(sourceView, emptyFC, 'TEST')


According to the documentation I should be able to use a shapefile as an input data set, but using the shapefile also produces the exact same error as the table view.

http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/append.htm

• The first parameter of Append is a list in the code samples in ArcGIS help page. Try arcpy.Append_management([sourceView], emptyFC, 'TEST') – Kadir Şahbaz Apr 12 '18 at 20:43
• nope same error, i think they used a list because they were appending mulitple shapefiles at once. – NULL.Dude Apr 12 '18 at 20:44
• Help page says "each input dataset must match the data type of the target dataset". That's, sourceViewand emptyFCmust match. You sure they are matched? – Kadir Şahbaz Apr 12 '18 at 20:58
• yes I updated the question @KadirŞahbaz – NULL.Dude Apr 12 '18 at 22:05
• I've rolled your question back because it invalidates an existing (and upvoted) answer. If your question has changed from appending a dBase table to a shapefile, to appending a shapefile to a shapefile, then you should research/ask that as a new question. – PolyGeo Apr 12 '18 at 22:24

## 1 Answer

I think that you are getting this error because you are trying to Append table records (which have no geometry) into a feature class which requires geometries.

You can append features with geometry from the same type of data. If you use TEST then they might be two (or more) feature classes with the same schema, or two (or more) shapefiles with the same schema.

However, dBASE tables do not store geometry and so cannot be appended to a feature class or shapefile,

• That or one or more of the fields are different.. the OP has specified 'TEST' in the append which means the schema must match exactly, but the error message supports your conclusion, it's just a shame that Esri error messages don't tell you which parameter it's having issues with; I suggest that it is the 2nd parameter that is considered in error as it's expecting a Table or Table View to match with the first parameter. – Michael Stimson Apr 12 '18 at 21:39
• so how do I import features with geometry, is it possible then? – NULL.Dude Apr 12 '18 at 22:05
• Just use the shapefile as the source in the append with the "NO TEST" option. – Dan Apr 12 '18 at 22:46