<?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 Re: Duplicate Records Returned By Python API since version 2.3 in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1578339#M11079</link>
    <description>&lt;P&gt;Having the exact same issue.&amp;nbsp; Will be logging a case.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jan 2025 18:45:56 GMT</pubDate>
    <dc:creator>NathanWarmerdam2</dc:creator>
    <dc:date>2025-01-23T18:45:56Z</dc:date>
    <item>
      <title>Duplicate Records Returned By Python API since version 2.3</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1548638#M10768</link>
      <description>&lt;P&gt;I have a premium support case open for this issue, but wanted to see if anyone else in the developer community has experienced duplicate features being returned when querying feature layers.&amp;nbsp; I have only been able to replicate this issue with services published to ArcGIS Enterprise from an Oracle database, not able to reproduce with hosted feature layers or services published from file geodatabases or SQL Server.&amp;nbsp; Also this issue is not reproducible on version prior to version 2.3.&lt;/P&gt;&lt;P&gt;This issue is when a layer this is coming from Oracle is queried using layer.query(), the result is returning duplicate features, with duplicate OBJECTIDs.&amp;nbsp; It will return the correct number of records, but after dropping the duplicates, there ends up being less features than their should be, so it is also not returning every record.&amp;nbsp;I have confirmed that the duplicates are there if you return the results as a feature set or as a dataframe.&lt;/P&gt;&lt;P&gt;Instead of returning all records in one query, I decided to try using the API with return_all_records set to False and page through the requests result_record_count and result_offset to get the data in batches of the max record count the layer.&amp;nbsp; Doing so does not result in duplicate records and also there are no missing records. This indicated that there is not an issue with the dataset itself, but with the Python API.&lt;/P&gt;&lt;P&gt;A major issue with their being duplicate OBJECTIDs, is that when you convert a data frame to a feature set using df.spatial.to_featureset() and there are duplicate OBJECTIDs, the OBJECTIDs for the resulting feature set are reset to start with 1 (might be another bug). This has caused some records to be updated incorrectly, or causing the update to fail since an invalid OBJECTID is sent.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For now I have asked staff to page through the requests, rather than get them in a single query.&amp;nbsp; However, this does require more lines of code.&amp;nbsp; Also if they do just use a single query to drop duplicates before converting to a feature set, so the OBJECTID is maintained.&lt;/P&gt;&lt;P&gt;The below sample is querying for all records and just returning the OBJECTID with no geometry.&amp;nbsp; The value_counts of the OBJECTID field of the dataframe shows that there are duplicate OBJECTIDs.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;fs = layer.query(out_fields=['OBJECTID'], return_geometry=False)
fs.sdf.OBJECTID.value_counts()
#OBJECTID
#528193    2
#528306    2
#528313    2
#528312    2
#528311    2
#         ..
#525523    1
#525522    1
#525521    1
#525520    1
#528097    1
#Name: count, Length: 2198, dtype: Int64&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 13:30:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1548638#M10768</guid>
      <dc:creator>Justin_Greco</dc:creator>
      <dc:date>2024-10-15T13:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Records Returned By Python API since version 2.3</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1548673#M10769</link>
      <description>&lt;P&gt;Sounds like gremlins in the machine&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is upgrading to version 2.4 in a non-production environment and testing if the issue still persists an option?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 14:44:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1548673#M10769</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2024-10-15T14:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Records Returned By Python API since version 2.3</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1548683#M10770</link>
      <description>&lt;P&gt;I did install 2.4 on my local environment and it is still an issue.&amp;nbsp; I've also tested on 2.2.0.1 and 1.8.2, where its not an issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 15:01:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1548683#M10770</guid>
      <dc:creator>Justin_Greco</dc:creator>
      <dc:date>2024-10-15T15:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Records Returned By Python API since version 2.3</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1556085#M10858</link>
      <description>&lt;P&gt;I am getting this same result using 2.3 and a feature service published from SQL Server. Feature count output is correct, but two duplicate OBJECTID/GLOBALIDs exist (5110 &amp;amp; 5111 below) and two features are not being output.&lt;/P&gt;&lt;P&gt;I can see the two missing features back in the Pro attribute table but not when querying the feature service with API code.&lt;/P&gt;&lt;P&gt;Any help on this is greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KyleGallagher16_0-1730926750229.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/118979iD4BFDBAA16DF961D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KyleGallagher16_0-1730926750229.png" alt="KyleGallagher16_0-1730926750229.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 21:50:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1556085#M10858</guid>
      <dc:creator>KyleGallagher16</dc:creator>
      <dc:date>2024-11-06T21:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Records Returned By Python API since version 2.3</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1556092#M10859</link>
      <description>&lt;P&gt;So I had assumed it was just Oracle, since I couldn't replicate with services pointed to SQL Server.&amp;nbsp; The only workaround I have found is to set return_all_records to False on the query request and page through all the data manually 1000 records (or whatever the max record count is set to) at a time and storing the features returned into a list after each request.&amp;nbsp; Then creating a feature set from all the features in a list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have submitted this to premium support and it was marked as a bug, but is still under review.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 21:59:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1556092#M10859</guid>
      <dc:creator>Justin_Greco</dc:creator>
      <dc:date>2024-11-06T21:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Records Returned By Python API since version 2.3</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1556103#M10860</link>
      <description>&lt;P&gt;And a warning, from this I learned that if you convert a dataframe to a featureset with duplicate OBJECTIDs, the OBJECTIDs are all reset to start with 1, which could really mess your data up big time if you send the featureset as an update. &amp;nbsp;Luckily I was dropping duplicates in my script before converting to a feature set.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 22:28:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1556103#M10860</guid>
      <dc:creator>Justin_Greco</dc:creator>
      <dc:date>2024-11-06T22:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Records Returned By Python API since version 2.3</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1556338#M10862</link>
      <description>&lt;P&gt;I just had a colleague run the exact same code against the exact same feature services using Pro 3.1 and API 2.1 and I got the desired results shown below.&lt;/P&gt;&lt;P&gt;I have two feature services with the exact same data, one is edited and the other only receives the updates based on GLOBALID, lastupdate, etc. For the insert process, I generate a list and count of GIDs on the edit side (11341 below), and a list and count of GIDs on the non-edit side (11339). If a GID exists on the edit side but not on the non-edit side,&amp;nbsp; the GID gets inserted using edit_features(adds). I would expect the two GIDs shown below to be inserted to the non-edit side.&lt;/P&gt;&lt;P&gt;Output using Pro 3.1 and API 2.1:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KyleGallagher16_0-1730993645196.png" style="width: 364px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/119042i10374DED176B4B70/image-dimensions/364x82?v=v2" width="364" height="82" role="button" title="KyleGallagher16_0-1730993645196.png" alt="KyleGallagher16_0-1730993645196.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, after recently updating to 3.3 and API 2.3, when executing the script it was not outputting these two GIDs to be inserted. Instead the list included two specific duplicate GIDs and left the two GIDs that should be inserted ^^^ out of the list.&lt;/P&gt;&lt;P&gt;Output using Pro 3.3 and API 2.3:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KyleGallagher16_1-1730994031273.png" style="width: 350px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/119043i3CBFE7D98E40825C/image-dimensions/350x106?v=v2" width="350" height="106" role="button" title="KyleGallagher16_1-1730994031273.png" alt="KyleGallagher16_1-1730994031273.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KyleGallagher16_2-1730994147849.png" style="width: 256px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/119044iA521BCA0A7449CA3/image-dimensions/256x97?v=v2" width="256" height="97" role="button" title="KyleGallagher16_2-1730994147849.png" alt="KyleGallagher16_2-1730994147849.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KyleGallagher16_3-1730994484946.png" style="width: 255px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/119049i8E0012FB986DFD9A/image-dimensions/255x98?v=v2" width="255" height="98" role="button" title="KyleGallagher16_3-1730994484946.png" alt="KyleGallagher16_3-1730994484946.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;We also have this script task scheduled on a machine with Pro 3.2.3 and API 2.2.0.1 and are encountering some odd behavior with massive amounts of inserts and deletes that shouldn't be occurring.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2024 15:53:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1556338#M10862</guid>
      <dc:creator>KyleGallagher16</dc:creator>
      <dc:date>2024-11-07T15:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Records Returned By Python API since version 2.3</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1578339#M11079</link>
      <description>&lt;P&gt;Having the exact same issue.&amp;nbsp; Will be logging a case.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2025 18:45:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1578339#M11079</guid>
      <dc:creator>NathanWarmerdam2</dc:creator>
      <dc:date>2025-01-23T18:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Records Returned By Python API since version 2.3</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1590698#M11186</link>
      <description>&lt;P&gt;Hey community.&lt;/P&gt;&lt;P&gt;Are there any updates on that one?&lt;/P&gt;&lt;P&gt;We're running into the same issues right now in a pretty big project. Could anyone maybe provide a workaround for it? We also tested GeoAccessor.from_layer() and query(). Both return double entries and other entries missing. Every edited, or added feature is double and seems to be replacing random other features, after turning it into a df.&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 15:25:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1590698#M11186</guid>
      <dc:creator>benedictmueller</dc:creator>
      <dc:date>2025-02-28T15:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Records Returned By Python API since version 2.3</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1590776#M11187</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;It was logged as BUG&lt;/SPAN&gt;-000171499 and fixed at 2.4.1.&amp;nbsp; I haven't upgraded to 2.4.1 to test yet.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 16:31:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1590776#M11187</guid>
      <dc:creator>Justin_Greco</dc:creator>
      <dc:date>2025-02-28T16:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Records Returned By Python API since version 2.3</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1592909#M11211</link>
      <description>&lt;P&gt;Good to hear its been fixed, as I am experiencing the same duplicate records issue with ArcGIS Pro 3.3.1 (arcgis 2.3.0).&lt;/P&gt;&lt;P&gt;I have another machine running ArcGIS Pro 3.2.2 (arcgis 2.2.0.1), and have no issues with this version.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 18:15:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1592909#M11211</guid>
      <dc:creator>GB_MattPanunto_GISS</dc:creator>
      <dc:date>2025-03-06T18:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Records Returned By Python API since version 2.3</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1669394#M11798</link>
      <description>&lt;P&gt;Anyone else still having this issue? It's occurring for me in a hosted notebook in AGOL. I have a notebook that was checking for duplicates (that ran fine on 3.9) but recently they forced the update to 3.12 and now it is broken due to this duplication of records returned by lyr.query() syntax.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Dec 2025 18:02:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/duplicate-records-returned-by-python-api-since/m-p/1669394#M11798</guid>
      <dc:creator>jtmouw_NCDOT</dc:creator>
      <dc:date>2025-12-01T18:02:00Z</dc:date>
    </item>
  </channel>
</rss>

