<?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: Python or Model Builder in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388428#M30700</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an example of one way to do this using Python.&amp;nbsp; You can iterate through the Sales table and append the sales to a list.&amp;nbsp; You can then remove duplicates from list, and iterate through the list.&amp;nbsp; Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14158981699337697" jivemacro_uid="_14158981699337697"&gt;
&lt;P&gt;import arcpy&lt;/P&gt;
&lt;P&gt;from arcpy import env&lt;/P&gt;
&lt;P&gt;env.workspace = r"C:\temp\python\test.gdb"&lt;/P&gt;
&lt;P&gt;env.overwriteOutput = 1&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;table = "Sales"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;#Create empty list&lt;/P&gt;
&lt;P&gt;list = []&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;with arcpy.da.SearchCursor(table, ["Sales"]) as cursor:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Append sales to list&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list.append(row[0])&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;del row, cursor&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;#Remove duplicates from list&lt;/P&gt;
&lt;P&gt;list = dict.fromkeys(list)&lt;/P&gt;
&lt;P&gt;list = list.keys()&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;#Iterate through list&lt;/P&gt;
&lt;P&gt;for sale in list:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(table, "tableView", "Sales = '" + sale + "'")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Nov 2014 17:03:03 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2014-11-13T17:03:03Z</dc:date>
    <item>
      <title>Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388427#M30699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have developed a model that the first step is to select records for a table with field name Sales, I manually now change sql expression from Sale 1 to Sale 2 etc, there are about 50 groups of sales. Once the&amp;nbsp; group is selected, it then is joined with a polygon feature Parcels, records copied, join removed and then onto the next group of sales (There are upto 50 sales for each parcel, so a simple join doesn't work,)&lt;/P&gt;&lt;P&gt;I would like to automate the sql expression that initially selects the records,&amp;nbsp; so that once the first group of sales is copied, join removed,&amp;nbsp; the table then selects the next group of sales.&amp;nbsp; Also I need a way to change the name of the copied features to match the sales group, so it doesn't overwrite.&lt;/P&gt;&lt;P&gt;The model works fine now, except that I must manually change the sql expression after each sale group and change the copied features name so it doesn't overwrite the previous sales group.&lt;/P&gt;&lt;P&gt;How can I automate the sql expression, if that is the appropriate approach?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 15:51:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388427#M30699</guid>
      <dc:creator>RickWarner</dc:creator>
      <dc:date>2014-11-13T15:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388428#M30700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is an example of one way to do this using Python.&amp;nbsp; You can iterate through the Sales table and append the sales to a list.&amp;nbsp; You can then remove duplicates from list, and iterate through the list.&amp;nbsp; Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14158981699337697" jivemacro_uid="_14158981699337697"&gt;
&lt;P&gt;import arcpy&lt;/P&gt;
&lt;P&gt;from arcpy import env&lt;/P&gt;
&lt;P&gt;env.workspace = r"C:\temp\python\test.gdb"&lt;/P&gt;
&lt;P&gt;env.overwriteOutput = 1&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;table = "Sales"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;#Create empty list&lt;/P&gt;
&lt;P&gt;list = []&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;with arcpy.da.SearchCursor(table, ["Sales"]) as cursor:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Append sales to list&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list.append(row[0])&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;del row, cursor&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;#Remove duplicates from list&lt;/P&gt;
&lt;P&gt;list = dict.fromkeys(list)&lt;/P&gt;
&lt;P&gt;list = list.keys()&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;#Iterate through list&lt;/P&gt;
&lt;P&gt;for sale in list:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(table, "tableView", "Sales = '" + sale + "'")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 17:03:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388428#M30700</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2014-11-13T17:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388429#M30701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, does this then allow me to group by sales grouping, ie Sales 1, say 100 records, then join them to a parcel map, copy features, then go on to the next Sales Group 2, say 200 records&amp;nbsp; and repeat join copy records?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 18:34:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388429#M30701</guid>
      <dc:creator>RickWarner</dc:creator>
      <dc:date>2014-11-13T18:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388430#M30702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your help,&lt;/P&gt;&lt;P&gt;I'm getting this error, what do you Think I'm doing wrong??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Runtime error&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 24, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\management.py", line 5748, in MakeFeatureLayer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e ExecuteError: ERROR 000840: The value is not a Feature Layer.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 22:09:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388430#M30702</guid>
      <dc:creator>RickWarner</dc:creator>
      <dc:date>2014-11-13T22:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388431#M30703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the backend storage format?&amp;nbsp; File geodatabase?&amp;nbsp; ArcSDE geodatabase?&amp;nbsp; I ask because there may be other approaches that work more efficiently if the data is all stored in a DBMS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 02:16:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388431#M30703</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-11-14T02:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388432#M30704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Although I think the approach is sound, it is bad practice to use a built-in function name as a variable identifier, i.e., naming a list 'list'.&amp;nbsp; The code as written will work, but shadowing a built-in name could cause confusion further down in the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another option for finding unique values is to use the set data type, which inherently doesn't allow duplicates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

#Create empty set&amp;nbsp; 
salesSet = set()&amp;nbsp; 





with arcpy.da.SearchCursor(table, ["Sales"]) as cursor:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for sale, in cursor:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Add sales to set&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; salesSet.add(sale)





del sale, cursor





#Iterate through set&amp;nbsp; 
for sale in salesSet:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(table, "tableView", "Sales = '" + sale + "'")&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; ... 


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A slightly different tack is to let the database engine identify unique values either through a SQL prefix&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

with arcpy.da.SearchCursor(table, ["Sales"], sql_clause=('DISTINCT', None)) as cursor:


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or SQL postfix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

with arcpy.da.SearchCursor(table, ["Sales"], sql_clause=(None, 'GROUP BY Sales')) as cursor:


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance wise, I am not sure where each approach falls out, but I can't imagine the differences being noticeable.&amp;nbsp; My personal preference is using DISTINCT in a SQL prefix, but I know that ArcGIS 10.1 had issues with SQL clauses in cursors, so using a set data type might work with more versions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:50:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388432#M30704</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T17:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388433#M30705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A cursory performance check shows SQL postfix being the quickest against a file geodatabase and SQL prefix being the slowest.&amp;nbsp; Runtimes relative to SQL postfix:&amp;nbsp; SQL postfix (+0%),&amp;nbsp; List (+3%),&amp;nbsp; Set (+4%), SQL prefix (+14%).&amp;nbsp; Interestingly enough, having the data in a personal geodatabase nearly doubled the runtimes of every approach across the board.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 04:07:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388433#M30705</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-11-14T04:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388434#M30706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm now getting a "Parsing error SyntaxError: invalid syntax (line 1)", which is the import arcpy statement. what could I now be doing wrong? I'm typing&amp;nbsp;&amp;nbsp; import arcpy??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 16:54:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388434#M30706</guid>
      <dc:creator>RickWarner</dc:creator>
      <dc:date>2014-11-17T16:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388435#M30707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you include more of the error message?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 18:08:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388435#M30707</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-11-17T18:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388436#M30708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Josh, I appreciate your help, I got that fixed, but now I'm hung up on table view, the way it is running now, each tableview is being overwritten by the next tableview, there are 20 or so groups of sales. I would like to join each tableview to a parcel map, copy those feature to a new file, then go on to the next sale group/table view. How would you suggest. MakeFature_management didn't work because I'm starting with a table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 18:21:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388436#M30708</guid>
      <dc:creator>RickWarner</dc:creator>
      <dc:date>2014-11-17T18:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388437#M30709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is easier to look at code and provide feedback than statements describing the code.&amp;nbsp; What code are you using to build the table views?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 20:54:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388437#M30709</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-11-17T20:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388438#M30710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;small suggestion...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replace:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14162642758525801 jive_text_macro" jivemacro_uid="_14162642758525801"&gt;
&lt;P&gt;#Create empty set&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;salesSet = set()&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;with arcpy.da.SearchCursor(table, ["Sales"]) as cursor:&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for sale, in cursor:&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Add sales to set&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; salesSet.add(sale) &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;del sale, cursor &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14162642856521041 jive_text_macro" jivemacro_uid="_14162642856521041"&gt;
&lt;P&gt;salesSet = set([r[0] for r in arcpy.da.SearchCursor(table, ["Sales"])])&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 22:45:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388438#M30710</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-11-17T22:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388439#M30711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree a list comprehension can shave several lines off the code block, but we also lose the with statement.&amp;nbsp; I don't know whether it is formally documented, but I have read and heard several Esri staffers say using with statements is a best practice when working with cursors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Nov 2014 23:28:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388439#M30711</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-11-17T23:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388440#M30712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep, I have heard that, but then at least delete the line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14162703659921991" jivemacro_uid="_14162703659921991"&gt;
&lt;P&gt;del sale, cursor&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since that is not necessary when using a with statement... At least that's what they say as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 00:26:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388440#M30712</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-11-18T00:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388441#M30713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using list comprehensions all over my code now and have experienced no problems.&amp;nbsp; Until one crops up, I will continue to use them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 00:30:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388441#M30713</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-11-18T00:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388442#M30714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't had any negative experience with them either and truly believe that a day without list comprehensions is a day not lived (or coded actually)...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 00:33:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388442#M30714</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-11-18T00:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388443#M30715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xander is that in Python Snippets?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 00:36:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388443#M30715</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-11-18T00:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388444#M30716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a separate post on that... &lt;A href="https://community.esri.com/docs/DOC-1975"&gt;Using Python List Comprehensions&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May have to rethink the python snippets and move things over to the python snippets place..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 00:40:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388444#M30716</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-11-18T00:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388445#M30717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The documentation does give the impression that database locks will be released, but the documentation doesn't get into specifics of which locks.&amp;nbsp; Currently, using a with statement for da-based search cursor releases the read lock on the layer but not the schema lock.&amp;nbsp; My guess is that the schema lock can't be removed because the with statement resets the cursor iteration to streamline using the cursor again.&amp;nbsp; Explicitly deleting the cursor object will remove the final schema lock.&amp;nbsp; Is this poor documentation or a bug?&amp;nbsp; I haven't submitted a Support case to get an answer, but I am leaning toward Esri saying the former.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 19:52:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388445#M30717</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-11-18T19:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Python or Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388446#M30718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think insert and update cursors were more the target for enabling with statements than search cursors, but people have a tendency to want to keep best practices simple.&amp;nbsp; Instead of having one best practice for insert and update cursors and a different one for search cursors, we have ended up with one for all three.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I like list comprehensions, and I think they can work well with search cursors.&amp;nbsp; I was just pointing out the trade-offs of the two approaches, not trying to evangelize one over the other.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 19:56:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-or-model-builder/m-p/388446#M30718</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2014-11-18T19:56:13Z</dc:date>
    </item>
  </channel>
</rss>

