<?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 sql_clause with UpdateCursor does not honor DISTINCT like SearchCursor does in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/sql-clause-with-updatecursor-does-not-honor/m-p/1357869#M69350</link>
    <description>&lt;P&gt;Using ArcGIS Pro 3.2&lt;/P&gt;&lt;P&gt;Here is the SearchCursor with sql_clause&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.SearchCursor('Buildings', "type", sql_clause=("DISTINCT type", None)) as cursor:
    for row in cursor:
        print(row[0])
office
church
retail
residential
commercial
public&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the UpdateCursor with sql_clause&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.UpdateCursor('Buildings', "type", sql_clause=("DISTINCT type", None)) as cursor:
    for row in cursor:
        print(row[0])

church
commercial
residential
commercial
commercial
commercial
commercial
retail
church
commercial
retail
commercial
retail
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UpdateCursor does not honor the DISTINCT sql_clause like the SearchCursor does. Why?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;There is an example in the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/updatecursor-class.htm" target="_blank" rel="noopener"&gt;Esri docs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.UpdateCursor(
        in_features, 
        ["OID@", "STREET_NAME"], 
        sql_clause=("DISTINCT STREET_NAME", None)
) as cur:&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Dec 2023 09:57:40 GMT</pubDate>
    <dc:creator>Clubdebambos</dc:creator>
    <dc:date>2023-12-07T09:57:40Z</dc:date>
    <item>
      <title>sql_clause with UpdateCursor does not honor DISTINCT like SearchCursor does</title>
      <link>https://community.esri.com/t5/python-questions/sql-clause-with-updatecursor-does-not-honor/m-p/1357869#M69350</link>
      <description>&lt;P&gt;Using ArcGIS Pro 3.2&lt;/P&gt;&lt;P&gt;Here is the SearchCursor with sql_clause&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.SearchCursor('Buildings', "type", sql_clause=("DISTINCT type", None)) as cursor:
    for row in cursor:
        print(row[0])
office
church
retail
residential
commercial
public&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the UpdateCursor with sql_clause&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.UpdateCursor('Buildings', "type", sql_clause=("DISTINCT type", None)) as cursor:
    for row in cursor:
        print(row[0])

church
commercial
residential
commercial
commercial
commercial
commercial
retail
church
commercial
retail
commercial
retail
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UpdateCursor does not honor the DISTINCT sql_clause like the SearchCursor does. Why?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;There is an example in the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/updatecursor-class.htm" target="_blank" rel="noopener"&gt;Esri docs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with arcpy.da.UpdateCursor(
        in_features, 
        ["OID@", "STREET_NAME"], 
        sql_clause=("DISTINCT STREET_NAME", None)
) as cur:&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 09:57:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sql-clause-with-updatecursor-does-not-honor/m-p/1357869#M69350</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2023-12-07T09:57:40Z</dc:date>
    </item>
  </channel>
</rss>

