<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Append only ids that don't exist in another class in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140330#M50937</link>
    <description>&lt;P&gt;I have 2 points classes with the same attributes, and I am looking to append data from one to the other. This is simple enough, but the first class has a lot of data that is already in the second class. I am looking to append only the rows/ids that don't exist in the other class already, and I can't seem to find an easy way to do this in pro. Any idea on how to do this?&lt;/P&gt;&lt;P&gt;For example, if this were a program it might look something like this:&lt;/P&gt;&lt;P&gt;for row in class1:&lt;/P&gt;&lt;P&gt;if row.id not in class2:&lt;/P&gt;&lt;P&gt;class2.append(row)&lt;/P&gt;</description>
    <pubDate>Thu, 03 Feb 2022 15:22:31 GMT</pubDate>
    <dc:creator>ThomasHamming</dc:creator>
    <dc:date>2022-02-03T15:22:31Z</dc:date>
    <item>
      <title>Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140330#M50937</link>
      <description>&lt;P&gt;I have 2 points classes with the same attributes, and I am looking to append data from one to the other. This is simple enough, but the first class has a lot of data that is already in the second class. I am looking to append only the rows/ids that don't exist in the other class already, and I can't seem to find an easy way to do this in pro. Any idea on how to do this?&lt;/P&gt;&lt;P&gt;For example, if this were a program it might look something like this:&lt;/P&gt;&lt;P&gt;for row in class1:&lt;/P&gt;&lt;P&gt;if row.id not in class2:&lt;/P&gt;&lt;P&gt;class2.append(row)&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:22:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140330#M50937</guid>
      <dc:creator>ThomasHamming</dc:creator>
      <dc:date>2022-02-03T15:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140336#M50939</link>
      <description>&lt;P&gt;A workaround. How about &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/append.htm" target="_self"&gt;&lt;STRONG&gt;Append&lt;/STRONG&gt; &lt;/A&gt;followed by &lt;STRONG&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/delete-identical.htm" target="_self"&gt;Delete Identical&lt;/A&gt;&lt;/STRONG&gt;?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:43:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140336#M50939</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2022-02-03T15:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140337#M50940</link>
      <description>&lt;P&gt;I wonder if a &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/pairwise-erase.htm" target="_self"&gt;Pairwise Erase&lt;/A&gt; workflow would accomplish this task.&amp;nbsp; The input features parameter is FC1.&amp;nbsp; The erase features parameter is FC2.&amp;nbsp; The output feature class is those features that are not coincident.&amp;nbsp; Then use the output feature class to append the data to FC2.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 15:44:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140337#M50940</guid>
      <dc:creator>Robert_LeClair</dc:creator>
      <dc:date>2022-02-03T15:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140527#M50969</link>
      <description>&lt;P&gt;Thanks, and this is a solution but not an ideal one. The class I am appending from has over 10,000 points, and a normal append operation would take hours to complete. Theoretically only adding missing points would take much less time.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 20:20:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140527#M50969</guid>
      <dc:creator>ThomasHamming</dc:creator>
      <dc:date>2022-02-03T20:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140707#M50990</link>
      <description>&lt;LI-CODE lang="python"&gt;target_class = "path:/to/class_2"
append_class = "path:/to/class_1"
id_field = "RowID"

# read the ids that are already in the target class
existing_ids = [row[0] for row in arcpy.da.SearchCursor(target_class, [id_field])]

# create an SQL where clause "IdField NOT IN (1, 2, 3)"
if isinstance(existing_ids[0], str):
    id_list = ["'{}'".format(i) for i in existing_ids]
else:
    id_list = [str(i) for i in existing_ids]
where_clause = "{} NOT IN ({})".format(id_field, ", ".join(id_list))

# create a layer of all append features that are not in the target class, append
append_layer = arcpy.management.MakeFeatureLayer(append_class,  "append_layer", where_clause)
arcpy.management.Append(append_layer, target_class)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 04 Feb 2022 09:16:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140707#M50990</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-02-04T09:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140794#M51004</link>
      <description>&lt;P&gt;Thank you, this worked!&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 15:36:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1140794#M51004</guid>
      <dc:creator>ThomasHamming</dc:creator>
      <dc:date>2022-02-04T15:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1164077#M54002</link>
      <description>&lt;P&gt;I am trying to get that script to work in python notebook but no luck. Just copied above and added paths for target_class, append_class and specified the id_field. I'm super new to this so its probably something simple I am not understanding.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN class=""&gt;SyntaxError&lt;/SPAN&gt; Traceback (most recent call last) File &lt;SPAN class=""&gt;C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\ast.py&lt;/SPAN&gt;, in &lt;SPAN class=""&gt;parse&lt;/SPAN&gt;: Line &lt;SPAN class=""&gt;35&lt;/SPAN&gt;: &lt;SPAN class=""&gt;return&lt;/SPAN&gt; &lt;SPAN class=""&gt;compile&lt;/SPAN&gt;(source, filename, mode, PyCF_ONLY_AST) &lt;SPAN class=""&gt;SyntaxError&lt;/SPAN&gt;: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape (&amp;lt;string&amp;gt;, line 2)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 18:48:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1164077#M54002</guid>
      <dc:creator>JonathanWhite1</dc:creator>
      <dc:date>2022-04-13T18:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1167399#M54390</link>
      <description>&lt;P&gt;Sorry it took so long to answer, I was on vacation... If you haven't found a soultion yet:&lt;/P&gt;&lt;P&gt;It's probably because you used backslashes instead of forward slashes in your paths. Single backslashes are special characters in Python strings, they are used to encode characters that you can't simply type, e.g. "\n" for a linebreak.&lt;/P&gt;&lt;P&gt;Use one of these methods:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# forward slashes
"path:/to/your/fc"
# double backslashes
"path:\\to\\your\\fc"
# define it as raw string
r"path:\to\your\fc"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 08:43:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1167399#M54390</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-04-25T08:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1174732#M55233</link>
      <description>&lt;P&gt;No matter what I do it just gives me this error below. I have tried just about everything. The only thing I can think of is perhaps this will not work with &lt;STRONG&gt;AGOL hosted tables&lt;/STRONG&gt;? The target layer is in an &lt;STRONG&gt;AGOL relationship class tables&lt;/STRONG&gt; while the append layer is just in &lt;STRONG&gt;AGOL feature set tables&lt;/STRONG&gt;. I have also attempted to use a local file geodatabase table as the append class but I get the same error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "S:\GISDataActive\ParcelMap\AutomatedUpdates\Appendaddress.py", line 24, in &amp;lt;module&amp;gt;&lt;BR /&gt;append_layer = arcpy.management.MakeFeatureLayer(append_class, "append_layer", where_clause)&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 9395, in MakeFeatureLayer&lt;BR /&gt;raise e&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 9392, in MakeFeatureLayer&lt;BR /&gt;retval = convertArcObjectToPythonObject(gp.MakeFeatureLayer_management(*gp_fixargs((in_features, out_layer, where_clause, workspace, field_info), True)))&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in &amp;lt;lambda&amp;gt;&lt;BR /&gt;return lambda *args: val(*gp_fixargs(args, True))&lt;BR /&gt;arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.&lt;BR /&gt;ERROR 000732: Input Features: Dataset &lt;A href="https://services2.arcgis.com/wEula7SYiezXcdRv/arcgis/rest/services/Parcel_Updates/FeatureServer/1" target="_blank" rel="noopener"&gt;https://services2.arcgis.com/wEula7SYiezXcdRv/arcgis/rest/services/Parcel_Updates/FeatureServer/1&lt;/A&gt; does not exist or is not supported&lt;BR /&gt;Failed to execute (MakeFeatureLayer).&lt;BR /&gt;Failed script AddressAppend...&lt;BR /&gt;Failed to execute (AddressAppend).&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 22:20:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1174732#M55233</guid>
      <dc:creator>JonathanWhite1</dc:creator>
      <dc:date>2022-05-17T22:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1174970#M55259</link>
      <description>&lt;P&gt;Oof. Yeah, arcpy (and in extension the desktop geoprocessing tools) don't play well with web content.&lt;/P&gt;&lt;P data-unlink="true"&gt;You can interact with hosted layers using the &lt;A href="https://developers.arcgis.com/python/" target="_blank" rel="noopener"&gt;ArcGIS API for Python&lt;/A&gt;, but I don't know anything about that.&lt;/P&gt;&lt;P data-unlink="true"&gt;So, you have two options:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Download the hosted layers, run my script in the desktop environment, overwrite the hosted layer with the result&lt;/LI&gt;&lt;LI&gt;Figure out how to do it in the Python API. There are probably multiple community members who can help you.&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Wed, 18 May 2022 08:51:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1174970#M55259</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-05-18T08:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1202116#M58537</link>
      <description>&lt;P&gt;Hello Johannes,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Awesome and elegant solution! I'm trying to use this script to achieve a similar delta load between two feature classes but I'm running into an error I can't seem to get past. Regardless of how I try to structure the WHERE clause...arcpy continues to throw the 000358 error code indicating something isn't right with the SQL syntax. I'm printing out the (large) where clause (I have about 18k unique STATION_IDs that it's parsing through)...but everything looks find from a syntax perspective.&amp;nbsp; After two days of testing/tweaking...I'm about to give up. Do you see anything amiss here? For development, both feature classes are local in a file geodatabase. I've tested in Python 3.x and 2.x and receive the same error in either environment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

target_class = "C:\\Rex\\WQM_STATIONS_FINAL\\WQM_STATIONS_DELTA_LOAD.gdb\\WQM_STATIONS_FINAL"
append_class = "C:\\Rex\\WQM_STATIONS_FINAL\\WQM_STATIONS_DELTA_LOAD.gdb\\WQM_STATIONS"
id_field = "STATION_ID"

# read the ids that are already in the target class
existing_ids = [row[0] for row in arcpy.da.SearchCursor(target_class, [id_field])]

# create a SQL where clause "STATION_ID NOT IN (1, 2, 3)"
if isinstance(existing_ids[0], str):
    id_list = ["'{}'".format(i) for i in existing_ids]
    #print id_list
else:
    id_list = ["'{}'".format(i) for i in existing_ids]
    #print id_list
where_clause = '{} NOT IN ({})'.format(id_field, ", ".join(id_list))
print (where_clause)
# create a layer of all append features that are not in the target class, append
append_layer = arcpy.management.MakeFeatureLayer(append_class,  "append_layer", where_clause)
arcpy.management.Append(append_layer, target_class)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RexRobichaux_0-1660244105414.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48464i7C5178B8D81733DB/image-size/large?v=v2&amp;amp;px=999" role="button" title="RexRobichaux_0-1660244105414.png" alt="RexRobichaux_0-1660244105414.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Johannes (and/or anyone else) that might have any ideas!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 12:34:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1202116#M58537</guid>
      <dc:creator>RexRobichaux</dc:creator>
      <dc:date>2022-08-12T12:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1202283#M58548</link>
      <description>&lt;P&gt;Syntax looks fine. Could maybe be something with your weird id format.&lt;/P&gt;&lt;P&gt;Is the field in the append class really called STATION_ID? Are you able to use the query in the Select By Attributes tool?&lt;/P&gt;&lt;P&gt;Can you post the gdb, either here or in a pm?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 06:15:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1202283#M58548</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-08-12T06:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1202339#M58555</link>
      <description>&lt;P&gt;Thanks for the prompt response Johannes! Correct- the field name in both feature classes is "STATION_ID". I've tried a subset selection in both ArcGIS Pro and ArcMap and both worked fine (with say 4-5 stations)... which further made me scratch my head. I've attached the zip scratch/dev file geodatabase to this post to see if that helps. If/when I get this working and pushed to test/prod, the WQM_STATIONS feature class will be access/stored in an enterprise Oracle geodatabase, however the target FC (WQM_STATIONS_FINAL) will still be in a FGDB.&lt;/P&gt;&lt;P&gt;PS- it's expected for there to be a good deal more attributes in the WQM_STATIONS_FINAL FC...I'll likely have to make a field mapping at some point as well for the append if I can just get past this SQL expression error. Thanks again for offering to take a look at this!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 12:30:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1202339#M58555</guid>
      <dc:creator>RexRobichaux</dc:creator>
      <dc:date>2022-08-12T12:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1202397#M58560</link>
      <description>&lt;P&gt;Yeah, it's your id values. Some of them contain apostrophes/single quotes. These characters are used in SQL to denote string values, so the where clause got corrupted.&lt;/P&gt;&lt;P&gt;For example, in this part, it recognizes the commas as string values and everything you actually want to select as mumbo jumbo:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1660314404543.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48515i49CAFE8EE1B129F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1660314404543.png" alt="JohannesLindner_0-1660314404543.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;(for the record, putting the where clause in there froze my PC for over 5 minutes. Can't imagine why, it's only 404.000 characters long :D)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well, turns out there is only one id with an apostrophe:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;[i for i in existing_ids if "'" in i]
["YOUNG'S POND"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So either fix that id or make the code safer. Online search suggests that to escape a single quote in SQL, you just put another single quote in front of it.&lt;/P&gt;&lt;P&gt;So the code gets a tiny bit more complicated (replace call in line 12):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

target_class = "C:\\Rex\\WQM_STATIONS_FINAL\\WQM_STATIONS_DELTA_LOAD.gdb\\WQM_STATIONS_FINAL"
append_class = "C:\\Rex\\WQM_STATIONS_FINAL\\WQM_STATIONS_DELTA_LOAD.gdb\\WQM_STATIONS"
id_field = "STATION_ID"

# read the ids that are already in the target class
existing_ids = [row[0] for row in arcpy.da.SearchCursor(target_class, [id_field])]

# create a SQL where clause "STATION_ID NOT IN (1, 2, 3)"
if isinstance(existing_ids[0], str):
    id_list = ["'{}'".format(i.replace("'", "''")) for i in existing_ids]
    #print id_list
else:
    id_list = ["'{}'".format(i) for i in existing_ids]
    #print id_list
where_clause = '{} NOT IN ({})'.format(id_field, ", ".join(id_list))
print (where_clause)
# create a layer of all append features that are not in the target class, append
append_layer = arcpy.management.MakeFeatureLayer(append_class,  "append_layer", where_clause)
arcpy.management.Append(append_layer, target_class)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And it works!&lt;/P&gt;&lt;P&gt;(And then the Append throws an exception, because your fields don't match, but that's besides the point...)&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 15:01:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1202397#M58560</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-08-12T15:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1202568#M58579</link>
      <description>&lt;P&gt;Awesome- thanks for sniffing that issue out Johannes...I suspected there might be a illicit character or two in there somewhere. This gets me up and running.&lt;/P&gt;&lt;P&gt;It's always surprised me there wasn't an off the shelf GP tool to do a delta compare/load as it's such a common ETL scenario (for us at least). Thanks again for the help and this nifty solution!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 20:55:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1202568#M58579</guid>
      <dc:creator>RexRobichaux</dc:creator>
      <dc:date>2022-08-12T20:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1306898#M70935</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way ion which the syntax can be run but doesn't create a new feature layer, and just appends the target dataset? It may already do this, I'm a python novice&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 11:46:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1306898#M70935</guid>
      <dc:creator>JustPete</dc:creator>
      <dc:date>2023-07-10T11:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1307444#M70978</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;doesn't create a new feature layer&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;The three easiest ways to solve the original question in Python are:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;create a layer with a definition query and append that layer (this is what my original answer does)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;create a layer of the whole feature class, select the wanted rows and append that layer&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;do it all with arcpy.da.*Cursors&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN&gt;Options one and two create a temporal layer. If you run the script in the Python Window of an ArcGIS Project, that layer will be added to the current map. If that is your problem, you can add these lines to the end to remove the layer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;try:
    m = arcpy.mp.ArcGISProject("current").activeMap
    lyr = m.listLayers("append_layer")[0]
    m.removeLayer(lyr)
except:
    print("Could not remove the temp layer")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you don't want to create the layer for a different reason, you can use option 3 (untested, will probably be slower for large datasets):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;target_class = "path:/to/class_2"
append_class = "path:/to/class_1"
id_field = "RowID"

# read the ids that are already in the target class
existing_ids = [row[0] for row in arcpy.da.SearchCursor(target_class, [id_field])]

# create an SQL where clause "IdField NOT IN (1, 2, 3)"
if isinstance(existing_ids[0], str):
    id_list = ["'{}'".format(i) for i in existing_ids]
else:
    id_list = [str(i) for i in existing_ids]
where_clause = "{} NOT IN ({})".format(id_field, ", ".join(id_list))

# get a list of all field names
fields = [f.name for f in arcpy.ListFields(target_class)]
# exclude some of those fields to avoid raising errors
# replace the field "Shape" with "SHAPE@"
exclude_fields = ["OBJECTID", "GlobalID", "Shape_Length", "Shape_Area"]
fields = [f for f in fields if f not in exclude_fields]
fields = ["SHAPE@" if f == "Shape" else f for f in fields]

# start inserting into the target class
with arcpy.da.InsertCursor(target_class, fields) as i_cursor:
    # start reading from the append_class, use the query we defined earlier
    with arcpy.da.SearchCursor(append_class, fields, where_clause) as s_cursor:
        # copy the rows
        for row in s_cursor:
            i_cursor.insertRow(row)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2023 06:34:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1307444#M70978</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-09-16T06:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1329102#M73096</link>
      <description>&lt;P&gt;Hi Johannes,&amp;nbsp;&lt;/P&gt;&lt;P&gt;This for the code, but it is returning this error:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;NameError&lt;/SPAN&gt;                                 Traceback (most recent call last)
In  &lt;SPAN class=""&gt;[3]&lt;/SPAN&gt;:
Line &lt;SPAN class=""&gt;18&lt;/SPAN&gt;:    fields = [f.name &lt;SPAN class=""&gt;for&lt;/SPAN&gt; f &lt;SPAN class=""&gt;in&lt;/SPAN&gt; arcpy.ListFields(fc)]

&lt;SPAN class=""&gt;NameError&lt;/SPAN&gt;: name 'fc' is not defined&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Sep 2023 15:16:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1329102#M73096</guid>
      <dc:creator>JustPete</dc:creator>
      <dc:date>2023-09-15T15:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1329344#M73125</link>
      <description>&lt;P&gt;Oops, used a wrong variable name... fixed&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2023 06:35:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1329344#M73125</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-09-16T06:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Append only ids that don't exist in another class</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1331454#M73327</link>
      <description>&lt;P&gt;Perfect, thanks Johannes&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 14:09:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/append-only-ids-that-don-t-exist-in-another-class/m-p/1331454#M73327</guid>
      <dc:creator>JustPete</dc:creator>
      <dc:date>2023-09-22T14:09:09Z</dc:date>
    </item>
  </channel>
</rss>

