<?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: Updating a feature layer with a global sql update in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313536#M24374</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I think I need to build the data dictionary first based on the list of rows already in the feature layer FinalNetworkLayerName as this restricts the number of row to be processed to between 3000 and 64000, whereas, in total, there are millions of potential rows to be processed. This still looks to me like I need to build the data dictionary row by row, which seems to me will probably result in the same amount of time taken if that time is taken up by mostly the SQL call istelf. However, if it is the update of the feature layer that is the majority of the 2 seconds taken, then there may be a saving, assuming that the building of the data dictionary is quick.&lt;BR /&gt;&lt;BR /&gt;That would mean attempting to build the data dictionary row by row using the list of all objectIDs from FinalNetworkLayerName. So is there efficient code for this process?&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;&lt;BR /&gt;Mark Wingfield&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Start by making the cursor a da cursor.&amp;nbsp; That is the most important thing to deal with first.&amp;nbsp; The old cursors will cause 10 times the delay.&amp;nbsp; Test your code on a small sample after doing that to see the difference it will make.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would not build a query with 3,000 to 64,000 ObjectIDs.&amp;nbsp; It will perform horribly since that is too huge of a list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could read the selected record set of the 3,000 to 64,000 records into a dictionary and then build a second dictionary doing a complete read of the entire database with millions of records but only add a record to the second dictionary where the key values matched.&amp;nbsp; Then do the UpdateCursor using the second dictionary.&amp;nbsp; Or perhaps you could just create the first dictionary with all of the fields needing updates, read the database with millions of records and if the key values match update the one dictionary and then use the one dictionary with the update cursor.&amp;nbsp; Either of these approaches will blow your current code away and not cause a memory issue.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your current code is already hitting an index with millions of records repeatedly each time you query the huge database, so a single read of the entire database is nothing in comparison.&amp;nbsp; The single read of the unfiltered database is likely to be faster than a query filter with 3,000 to 64,000 conditions and you should try the above suggestion before creating a where clause with that many conditions.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 May 2014 13:13:47 GMT</pubDate>
    <dc:creator>RichardFairhurst</dc:creator>
    <dc:date>2014-05-27T13:13:47Z</dc:date>
    <item>
      <title>Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313525#M24363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Currently, I have a feature layer that I step through row by row and update each row in the layer with output data from a SQL function. This works but is slow. I have been asked to try and speed this up and the suggestion was to attempt some form of global update in one go tat could link the feature class to a function or view and update all rows in one go. The data returned from the current function relies on inputs from the current row to create the returned data. I have attached the current code below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; message = "[INFO]&amp;nbsp; Looping through selected RoadNetwork started at " + str(datetime.datetime.now()) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print message&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(message)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LogFile.write(message + "\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Call function to get extra columns&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = arcpy.UpdateCursor(FinalNetworkLayerName)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for featurerow in cursor:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow = currentRow + 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if currentRow%100 == 0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; message = "[INFO]&amp;nbsp; Processed " + str(currentRow) + " of " + str(RoadNetworkCount) + " rows at " + str(datetime.datetime.now())&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print message&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(message)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LogFile.write(message + "\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentToid = featurerow.TOID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Establishing connection to MSSQL database&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sql = "SELECT * FROM [DWOP].[dbo].[ufunc_ReturnGGFData] ('" + CurrentToid + "'," + OfficeIDParm &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Call function&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sde_return = sdeConn2.execute(sql)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if isinstance(sde_return, list):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in sde_return:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.SEG_ID = row[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.STL_NAME = row[1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.STR_NAME = row[2]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.ST_CLASS = row[3]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.ORIG_LVL = row[4]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.DEST_LVL = row[5]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.ONEWAY = row[6]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.SPEED1 = row[7]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.SPEED2 = row[8]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.SPEED3 = row[9]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.SPEED4 = row[10]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.TRN_MODE = row[11]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.BTH_MODE = row[12]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.RESTR_ORI = row[13]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.RESTR_DEST = row[14]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(featurerow)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; del cursor, featurerow&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As I stated above. this works but is quite slow (averaging over 2 seconds per row update).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems unlikely to me that such a global update could be done but I am new to ArcPy so may be missing something.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mark&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 06:31:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313525#M24363</guid>
      <dc:creator>MarkWingfield</dc:creator>
      <dc:date>2014-05-22T06:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313526#M24364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Currently, I have a feature layer that I step through row by row and update each row in the layer with output data from a SQL function. This works but is slow. I have been asked to try and speed this up and the suggestion was to attempt some form of global update in one go tat could link the feature class to a function or view and update all rows in one go. The data returned from the current function relies on inputs from the current row to create the returned data. I have attached the current code below:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; message = "[INFO]&amp;nbsp; Looping through selected RoadNetwork started at " + str(datetime.datetime.now()) 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print message
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(message)
&amp;nbsp;&amp;nbsp;&amp;nbsp; LogFile.write(message + "\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Call function to get extra columns
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = arcpy.UpdateCursor(FinalNetworkLayerName)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for featurerow in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow = currentRow + 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if currentRow%100 == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; message = "[INFO]&amp;nbsp; Processed " + str(currentRow) + " of " + str(RoadNetworkCount) + " rows at " + str(datetime.datetime.now())&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print message
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage(message)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LogFile.write(message + "\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentToid = featurerow.TOID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Establishing connection to MSSQL database

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sql = "SELECT * FROM [DWOP].[dbo].[ufunc_ReturnGGFData] ('" + CurrentToid + "'," + OfficeIDParm 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Call function
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sde_return = sdeConn2.execute(sql)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if isinstance(sde_return, list):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in sde_return:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.SEG_ID = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.STL_NAME = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.STR_NAME = row[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.ST_CLASS = row[3]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.ORIG_LVL = row[4]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.DEST_LVL = row[5]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.ONEWAY = row[6]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.SPEED1 = row[7]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.SPEED2 = row[8]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.SPEED3 = row[9]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.SPEED4 = row[10]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.TRN_MODE = row[11]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.BTH_MODE = row[12]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.RESTR_ORI = row[13]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow.RESTR_DEST = row[14]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(featurerow)

&amp;nbsp;&amp;nbsp;&amp;nbsp; del cursor, featurerow
&lt;/PRE&gt;&lt;BR /&gt;As I stated above. this works but is quite slow (averaging over 2 seconds per row update).&lt;BR /&gt;&lt;BR /&gt;It seems unlikely to me that such a global update could be done but I am new to ArcPy so may be missing something.&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;&lt;BR /&gt;Mark&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;First of all, use the Code tags (the # button) around Python code to preserve the spacing in a forum post.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are using ArcMap 10.0 or above convert your UpdateCursor to a &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000014000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Data Access Update cursor&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; They are at least 10 times faster than the old style cursors.&amp;nbsp; Also, supply a field list that limits the fields read to only access the fields you need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;About the only way to speed it up is to loop through all selected features with a SearchCursor first and create a list or dictionary of all ObjectIDs, then input the full list to a single query to the MS SQL database using an IN operation.&amp;nbsp; Then create a dictionary of the entire read of the MS SQL data and all its related fields in one pass using the same ObjectID value as the key.&amp;nbsp; Then do the update code, but use the dictionary key to find the related data instead of performing a query.&amp;nbsp; Dictionary searches are up to 100 times faster than SQL queries.&amp;nbsp; For example, if there are 100 selected features this approach would reduce 101 queries to 3 queries and 2 list/dictionary reads.&amp;nbsp; That should gain a large performance boost.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Queries are expensive because they have to use physical hardware and network throughput to access and transfer the data, while dictionaries are built in local memory.&amp;nbsp; So 100 random access hits by query are much slower than 100 random access hits to a dictionary in memory.&amp;nbsp; A single query of a 100 ObjectID list will be faster, because the cursor read is not random, but sequential, and field indexing has a better effect through 1 query than through 100 queries, since the index is only traversed once for 1 query, but has to be traversed 100 times for 100 queries.&amp;nbsp; (I assume you have an index on all of the related fields your queries hit, since unindexed fields should never be used to create a relationship between 2 database tables.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the ObjectID list is crazy huge you may need to chunk it into selection groups with the modulus operator so that the SQL where clause is not excessively large.&amp;nbsp; Then query that group back to a separate layer copy of the input selection layer.&amp;nbsp; The layer copy would be created outside of your loop using the Make Feature Layer operation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this is helpful, see my signature line for info on voting for helpful posts.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:57:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313526#M24364</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T14:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313527#M24365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;STRONG&gt;If the ObjectID list is crazy huge&lt;/STRONG&gt; you may need to chunk it into selection groups with the modulus operator so that the SQL where clause is not excessively large.&amp;nbsp; Then query that group back to a separate layer copy of the input selection layer.&amp;nbsp; The layer copy would be created outside of your loop using the Make Feature Layer operation.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This could certainly throw a wrench into the "IN" statement approach --- is there any issues with chunk processing part?&amp;nbsp; One potential alternative idea is to use a Table Variable instead.&amp;nbsp; If the list of OID's is really large you could first run an insert into the table variable then simply JOIN this to the table in your main query.&amp;nbsp; This design approach would be best fit into a StoredProcedure rather than dynamic SQL though (not a bad plan either as the SQL statement will have already been compiled on the server).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 14:03:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313527#M24365</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2014-05-22T14:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313528#M24366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This could certainly throw a wrench into the "IN" statement approach --- is there any issues with chunk processing part?&amp;nbsp; One potential alternative idea is to use a Table Variable instead.&amp;nbsp; If the list of OID's is really large you could first run an insert into the table variable then simply JOIN this to the table in your main query.&amp;nbsp; This design approach would be best fit into a StoredProcedure rather than dynamic SQL though (not a bad plan either as the SQL statement will have already been compiled on the server).&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I agree that really large ObjectID lists will be a significant factor in deciding the best optimization approach if that is a factor.&amp;nbsp; Such lists are even more of a reason to scrap the approach that creates a new query for every individual ObjectID.&amp;nbsp; Under any circumstance start by using the Data Access version of the Updatecursor, since that will give the code a huge boost and should immediately improve the 2 seconds per record performance which should largely be due to using an old style cursor.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 14:24:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313528#M24366</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-05-22T14:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313529#M24367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Some comments and examples:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Use a dictionary, as Richard said its way faster than using imbedded cursors, and your bosses will of course give you a raise, since you improved the performance so much.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. If the dictionary gets "too big"... that is it occupies more than ~2.1 GB of RAM, which is the (sort of) limit of 32-bit Python, you can use 64-bit Python along with the 64-bit "ArcGIS_BackgroundGP_for_Desktop_101sp1.exe", which basically turns arcpy (v10.1+) into a 64-bit bad a$$ capable of using gobs of RAM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's an (untested) example of that dictionary calculaty sort of thing... It sucks and existing table into a dictionary, and then updates the table by calcing the ID field value = to the sum of all the (original) ID values that are &amp;gt;= the ID value being processed. Why would you would want to do that? I don't know, but it illustrates the general concept.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;myTable = r"C:\temp\test.gdb\test"
valueDict = {r[0]:(r[1]) for r in arcpy.da.SearchCursor(myTable, ["OID@","ID"])} 
updateRows = arcpy.da.UpdateCursor(myTable, ["OID@","ID"])
for updateRow in updateRows:
&amp;nbsp;&amp;nbsp; oidVal, idVal = updateRow
&amp;nbsp;&amp;nbsp; updateRow[1] = sum([i[0] for i in valueDict if valueDict&lt;I&gt;[0] &amp;gt;= idVal])
&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow)
del updateRow, updateRows &lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:57:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313529#M24367</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T14:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313530#M24368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Some comments and examples:&lt;BR /&gt;&lt;BR /&gt;1. Use a dictionary, as Richard said its way faster than using imbedded cursors, and your bosses will of course give you a raise, since you improved the performance so much.&lt;BR /&gt;2. If the dictionary gets "too big"... that is it occupies more than ~2.1 GB of RAM, which is the (sort of) limit of 32-bit Python, you can use 64-bit Python along with the 64-bit "ArcGIS_BackgroundGP_for_Desktop_101sp1.exe", which basically turns arcpy (v10.1+) into a 64-bit bad a$$ capable of using gobs of RAM.&lt;BR /&gt;&lt;BR /&gt;Here's an (untested) example of that dictionary calculaty sort of thing... It sucks and existing table into a dictionary, and then updates the table by calcing the ID field value = to the sum of all the (original) ID values that are &amp;gt;= the ID value being processed. Why would you would want to do that? I don't know, but it illustrates the general concept.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;myTable = r"C:\temp\test.gdb\test"
valueDict = {r[0]:(r[1]) for r in arcpy.da.SearchCursor(myTable, ["OID@","ID"])} 
updateRows = arcpy.da.UpdateCursor(myTable, ["OID@","ID"])
for updateRow in updateRows:
&amp;nbsp;&amp;nbsp; oidVal, idVal = updateRow
&amp;nbsp;&amp;nbsp; updateRow[1] = sum([i[0] for i in valueDict if valueDict&lt;I&gt;[0] &amp;gt;= idVal])
&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow)
del updateRow, updateRows &lt;/I&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good point.&amp;nbsp; The entire related table can just be read into a dictionary so that it has the complete set of ID keys without using any where clause.&amp;nbsp; If that was done before processing the update cursor then the update loop can just match to the dictionary keys.&amp;nbsp; That way it doesn't matter how big the ObjectID list is and no where clause needs to be generated at all.&amp;nbsp; It also cuts the number of cursor loops down to just two cursor loops that are completely independent of each other.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:57:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313530#M24368</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T14:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313531#M24369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;After reading your original post, all you are doing is basically a join/calc... the performance of which still can be improved using a dictionary/update cursor. This is some older code (doesn't use .da cursors, dictionary comprehensions, etc.) but it illustrates the traditional join and calc sort of thing you are trying to accomplish.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/9555-Modifying-Permanent-Sort-script-by-Chris-Snyder?p=30010&amp;amp;viewfull=1#post30010"&gt;http://forums.arcgis.com/threads/9555-Modifying-Permanent-Sort-script-by-Chris-Snyder?p=30010&amp;amp;viewfull=1#post30010&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 17:56:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313531#M24369</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2014-05-22T17:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313532#M24370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;After reading your original post, all you are doing is basically a join/calc... the performance of which still can be improved using a dictionary/update cursor. This is some older code (doesn't use .da cursors, dictionary comprehensions, etc.) but it illustrates the traditional join and calc sort of thing you are trying to accomplish.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/9555-Modifying-Permanent-Sort-script-by-Chris-Snyder?p=30010&amp;amp;viewfull=1#post30010"&gt;http://forums.arcgis.com/threads/9555-Modifying-Permanent-Sort-script-by-Chris-Snyder?p=30010&amp;amp;viewfull=1#post30010&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The only time I have found that this style is necessary is in a label expression that pulls data from a related table with a One to Many or Many to Many relationship.&amp;nbsp; Because the label expression is repeatedly read for every label generated, almost like the expression is within a cursor loop, there is no benefit to reading the entire related table into a dictionary within the label expression.&amp;nbsp; The dictionary would just be regenerated for every label and no cursor reads would be eliminated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 18:06:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313532#M24370</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-05-22T18:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313533#M24371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think I get the giste of what you are all saying but I am brand new to Pythons and am still struggling.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Given the code I had before and the fact that a slightly altered version of the SQL function (hopefully to fit in with a data dictionary solution) returns one row of data in the following format with the OBJECTID for the current row as an input:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; SEG_ID int,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; STL_NAME varchar(100),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; STR_NAME varchar(100),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ST_CLASS char(1),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ORIG_LVL int,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; DEST_LVL int,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ONEWAY int,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; SPEED1 float,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; SPEED2 float,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; SPEED3 float,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; SPEED4 float,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; TRN_MODE char(8),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; BTH_MODE char(8),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; RESTR_ORI varchar(2000),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; RESTR_DEST varchar(2000),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TOID varchar(16),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OBJECTID id &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My current code using da.UpdateCursor instead of the standard UpdateCursor is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fields = ("SEG_ID", "STL_NAME", "STR_NAME", "ST_CLASS", "ORIG_LVL", "DEST_LVL", "ONEWAY", "SPEED1", "SPEED2", "SPEED3", "SPEED4", "TRN_MODE", "BTH_MODE", "RESTR_ORI", "RESTR_DEST", "TOID", "OBJECTID")
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = arcpy.da.UpdateCursor(FinalNetworkLayerName, fields)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for featurerow in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentObjectID = featurerow[17]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Establishing connection to MSSQL database

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sql = "SELECT * FROM [DWOP].[dbo].[ufunc_ReturnGGFDataObjectID] (" + CurrentObjectId + "," + OfficeIDParm 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Call function
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sde_return = sdeConn2.execute(sql)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if isinstance(sde_return, list):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in sde_return:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[0] = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[1] = row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[2] = row[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[3] = row[3]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[4] = row[4]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[5] = row[5]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[6] = row[6]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[7] = row[7]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[8] = row[8]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[9] = row[9]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[10] = row[10]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[11] = row[11]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[12] = row[12]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[13] = row[13]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featurerow[14] = row[14]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(featurerow)

&amp;nbsp;&amp;nbsp;&amp;nbsp; del cursor, featurerow
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am looking at a data dictionary definition of :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;rdlkDict = dict([(r.OBJECTID, (r.SEG_ID, r.STL_NAME, r.STR_NAME, r.ST_CLASS, r.ORIG_LVL, r.DEST_LVL, r.ONEWAY, r.SPEED1, r.SPEED2, r.SPEED3, r.SPEED4, r.TRN_MODE, r.BTH_MODE, r.RESTR_ORI, r.RESTR_DEST, r.TOID)) for r in arcpy.SearchCursor(FinalNetworkLayerName)])&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How would I populate this from the SQl call and then how do I link this to the FinalNetworkLayerName feature class? I cannot get my head around how the loops work and relate to each other to update 15 columns from the SQL call via the data dictionary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry, I am completely new to Python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:57:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313533#M24371</guid>
      <dc:creator>MarkWingfield</dc:creator>
      <dc:date>2021-12-11T14:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313534#M24372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So 1st thing is to get your MSSQL table into a dictionary... I don't use MYSQL, but I image you have some sort of database connection file, right? Also, in my example below, I am assuming the MySQL table has a field called OBJECTID that you are using as the join item, but that's probably not the case. OBJECTID is generally a poor choice for a join field since it is not stable. Anyway... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mySqlTable = r"\\mynetwork\myconnectionfile.sde"
mySqlFieldsToReturnList = ["OBJECTID", "SEG_ID", "STL_NAME", "STR_NAME", ...]
rdlkDict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(mySqlTbl, mySqlFieldsToReturnList)}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So now you should have this awesome dictionary where the key is the join item, and all the field values &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;that you will need in your update cursor are readily available at light speed. The cool thing now is that the dictionary can look up the values from the SQL table a kazzilion times faster than the "sql = "SELECT * FROM [DWOP].[dbo].[ufunc_ReturnGGFDataObjectID" thingy was.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:57:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313534#M24372</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T14:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313535#M24373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think I need to build the data dictionary first based on the list of rows already in the feature layer FinalNetworkLayerName as this restricts the number of row to be processed to between 3000 and 64000, whereas, in total, there are millions of potential rows to be processed. This still looks to me like I need to build the data dictionary row by row, which seems to me will probably result in the same amount of time taken if that time is taken up by mostly the SQL call istelf. However, if it is the update of the feature layer that is the majority of the 2 seconds taken, then there may be a saving, assuming that the building of the data dictionary is quick.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That would mean attempting to build the data dictionary row by row using the list of all objectIDs from FinalNetworkLayerName. So is there efficient code for this process?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mark Wingfield&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 12:37:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313535#M24373</guid>
      <dc:creator>MarkWingfield</dc:creator>
      <dc:date>2014-05-27T12:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313536#M24374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I think I need to build the data dictionary first based on the list of rows already in the feature layer FinalNetworkLayerName as this restricts the number of row to be processed to between 3000 and 64000, whereas, in total, there are millions of potential rows to be processed. This still looks to me like I need to build the data dictionary row by row, which seems to me will probably result in the same amount of time taken if that time is taken up by mostly the SQL call istelf. However, if it is the update of the feature layer that is the majority of the 2 seconds taken, then there may be a saving, assuming that the building of the data dictionary is quick.&lt;BR /&gt;&lt;BR /&gt;That would mean attempting to build the data dictionary row by row using the list of all objectIDs from FinalNetworkLayerName. So is there efficient code for this process?&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;&lt;BR /&gt;Mark Wingfield&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Start by making the cursor a da cursor.&amp;nbsp; That is the most important thing to deal with first.&amp;nbsp; The old cursors will cause 10 times the delay.&amp;nbsp; Test your code on a small sample after doing that to see the difference it will make.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would not build a query with 3,000 to 64,000 ObjectIDs.&amp;nbsp; It will perform horribly since that is too huge of a list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could read the selected record set of the 3,000 to 64,000 records into a dictionary and then build a second dictionary doing a complete read of the entire database with millions of records but only add a record to the second dictionary where the key values matched.&amp;nbsp; Then do the UpdateCursor using the second dictionary.&amp;nbsp; Or perhaps you could just create the first dictionary with all of the fields needing updates, read the database with millions of records and if the key values match update the one dictionary and then use the one dictionary with the update cursor.&amp;nbsp; Either of these approaches will blow your current code away and not cause a memory issue.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your current code is already hitting an index with millions of records repeatedly each time you query the huge database, so a single read of the entire database is nothing in comparison.&amp;nbsp; The single read of the unfiltered database is likely to be faster than a query filter with 3,000 to 64,000 conditions and you should try the above suggestion before creating a where clause with that many conditions.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 13:13:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313536#M24374</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-05-27T13:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313537#M24375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is a sample of code I just wrote to replace a data transfer operation that originally used joins and field calculations.&amp;nbsp; It affects about 114,000 related records in two tables.&amp;nbsp; It takes about a half minute to processes as compared to about 30 minutes with the original calculations.&amp;nbsp; Assume readFC and outputFC have been defined previously in my code as the two related feature classes.&amp;nbsp; OBJECTID in the readFC joins to FROM_OBJECTID in the outputFC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;readFieldsList = ["OBJECTID", "RID", "MEAS", "X_COORD", "Y_COORD", "X_Y_LINK", "STNAME", "STNAMES", "X_Y_ROUTE"]
valueDict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(readFC, readFieldsList)}

updateFieldsList =&amp;nbsp; ["FROM_OBJECTID","FROM_ROUTE_NAME","FROM_MEASURE","FROM_MEAS","FROM_X_COORDINATE","FROM_Y_COORDINATE","FROM_X_Y_LINK","FROM_STREET_NAME","FROM_CROSS_STREETS","FROM_X_Y_ROUTE_NAME"]
with arcpy.da.UpdateCursor(outputFC, updateFieldsList) as updateRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for updateRow in updateRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ObjectIDVal = updateRow[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ObjectIDVal in valueDict:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[1] = valueDict[ObjectIDVal][0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[2] = valueDict[ObjectIDVal][1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[3] = valueDict[ObjectIDVal][1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[4] = valueDict[ObjectIDVal][2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[5] = valueDict[ObjectIDVal][3]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[6] = valueDict[ObjectIDVal][4]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[7] = valueDict[ObjectIDVal][5]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[8] = valueDict[ObjectIDVal][6]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[9] = valueDict[ObjectIDVal][7]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This code is based on the original suggestion that reads the entire related table into a dictionary and not the suggestion of my last post.&amp;nbsp; However, it shows how to retrieve items from a list inside of a dictionary.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:57:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313537#M24375</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T14:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313538#M24376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Given that there was mention of using a list of objectIDs from the FinalNetworkLayerName feature layer, it would be possible for the function to be part of a SQL Select statement and the objectids passed into this as a Where clause. And then I guess this can be called to create a data dictionary but still unsure about the code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this was the solution (and given that I would need to deal with chunks of data as I don't believe SQL Server 2008 can deal with over 60000 entries in a single WHERE.....IN (....)... statement), how would I code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Create a data Dictionary for the first chunk of objectIDs from FinalNetworkLayerName, passing these to the WHERE clause of a SQL statement &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Update the same Data Dictionary for &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;x&lt;/SPAN&gt;&lt;SPAN&gt; chunks of objectIDs, also passing to a WHERE clause, until the end of FinalNetworkLayerName &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Then update FinalNetworkLayerName by matching to the objectIDs in the Data Dictionary&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mark&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 13:47:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313538#M24376</guid>
      <dc:creator>MarkWingfield</dc:creator>
      <dc:date>2014-05-27T13:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313539#M24377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Given that there was mention of using a list of objectIDs from the FinalNetworkLayerName feature layer, it would be possible for the function to be part of a SQL Select statement and the objectids passed into this as a Where clause. And then I guess this can be called to create a data dictionary but still unsure about the code.&lt;BR /&gt;&lt;BR /&gt;If this was the solution (and given that I would need to deal with chunks of data as I don't believe SQL Server 2008 can deal with over 60000 entries in a single WHERE.....IN (....)... statement), how would I code:&lt;BR /&gt;&lt;BR /&gt;1. Create a data Dictionary for the first chunk of objectIDs from FinalNetworkLayerName, passing these to the WHERE clause of a SQL statement &lt;BR /&gt;2. Update the same Data Dictionary for &lt;SPAN style="font-style:italic;"&gt;x&lt;/SPAN&gt; chunks of objectIDs, also passing to a WHERE clause, until the end of FinalNetworkLayerName &lt;BR /&gt;&lt;BR /&gt;3. Then update FinalNetworkLayerName by matching to the objectIDs in the Data Dictionary&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;&lt;BR /&gt;Mark&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Your concept is wrong and I am no longer advocating that approach.&amp;nbsp; No query where clause filter needs to be built.&amp;nbsp; It can be handled by the conditional python code in the for loop that reads:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ObjectIDVal = updateRow[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if ObjectIDVal in valueDict:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As the cursor is read this code performs the function of a where clause against the dictionary you have built to validate that the current ObjectID value exists as a dictionary key.&amp;nbsp; Updates are only done if the key is found.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 13:53:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313539#M24377</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-05-27T13:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313540#M24378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I will try to adapt my example code to follow my last suggestion which would read the dictionary from the selection set of the output feature class, update the dictionary from a read source that may be much larger, and finally update the output feature class from the updated dictionary:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;updateFieldsList =&amp;nbsp; ["FROM_OBJECTID","FROM_ROUTE_NAME","FROM_MEASURE","FROM_MEAS","FROM_X_COORDINATE","FROM_Y_COORDINATE","FROM_X_Y_LINK","FROM_STREET_NAME","FROM_CROSS_STREETS","FROM_X_Y_ROUTE_NAME"]
valueDict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(outputFC, updateFieldsList)}

readFieldsList = ["OBJECTID", "RID", "MEAS", "X_COORD", "Y_COORD", "X_Y_LINK", "STNAME", "STNAMES", "X_Y_ROUTE"]
with arcpy.da.SearchCursor(readFC, readFieldsList) as readRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for readRow in readRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ObjectIDVal = readRow[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ObjectIDVal in valueDict:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valueDict[ObjectIDVal][0] = readRow[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valueDict[ObjectIDVal][1] = readRow[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valueDict[ObjectIDVal][2] = readRow[2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valueDict[ObjectIDVal][3] = readRow[3]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valueDict[ObjectIDVal][4] = readRow[4]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valueDict[ObjectIDVal][5] = readRow[5]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valueDict[ObjectIDVal][6] = readRow[6]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valueDict[ObjectIDVal][7] = readRow[7]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valueDict[ObjectIDVal][8] = readRow[8]

with arcpy.da.UpdateCursor(outputFC, updateFieldsList) as updateRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for updateRow in updateRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ObjectIDVal = updateRow[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[1] = valueDict[ObjectIDVal][0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[2] = valueDict[ObjectIDVal][1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[3] = valueDict[ObjectIDVal][2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[4] = valueDict[ObjectIDVal][3]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[5] = valueDict[ObjectIDVal][4]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[6] = valueDict[ObjectIDVal][5]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[7] = valueDict[ObjectIDVal][6]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[8] = valueDict[ObjectIDVal][7]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[9] = valueDict[ObjectIDVal][8]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:57:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313540#M24378</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T14:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313541#M24379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks all for your help so far. I am going with the data dictionary option and am currently working through this. The issue I do have is with debugging, in that, when running my code, it suggests that the data dictionary (I have called this rdlkDict) has been created successfully (based on using a MakeQueryTable step that calls a view returning SQL data to be matched). The data in the MakeQueryTable layer looks to be fully populated when I open it in ArcMap. However, the match does not appear to have updated anything so i need to check contents of the data dictionary. My code is below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; message = "[INFO]&amp;nbsp; Create table of general GGF data started at " + str(datetime.datetime.now()) 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print message
&amp;nbsp;&amp;nbsp;&amp;nbsp; viewName = "DWOP.DBO.VWO_GenerateGeorouteFilesNonSpatial"
&amp;nbsp;&amp;nbsp;&amp;nbsp; fullViewName = arcpy.env.workspace + os.sep + viewName
&amp;nbsp;&amp;nbsp;&amp;nbsp; tableLayerName = "GGF_Data" + OfficeID
&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldList = [[viewName + ".OBJECTID"],[viewName + ".TOID"],[viewName + ".OFFICE_ID"],[viewName + ".SEG_ID"],[viewName + ".STL_NAME"],[viewName + ".STR_NAME"],[viewName + ".ST_CLASS"],[viewName + ".ORIG_LVL"],[viewName + ".DEST_LVL"],[viewName + ".ONEWAY"],[viewName + ".SPEED1"],[viewName + ".SPEED2"],[viewName + ".SPEED3"],[viewName + ".SPEED4"],[viewName + ".TRN_MODE"],[viewName + ".BTH_MODE"],[viewName + ".RESTR_ORI"],[viewName + ".RESTR_DEST"]]
&amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause = "OFFICE_ID = " + OfficeID
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeQueryTable_management(fullViewName,tableLayerName,"USE_KEY_FIELDS",viewName + ".OBJECTID",fieldList,whereClause)&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; message = "[INFO]&amp;nbsp; Create Data Dictionary of general GGF data started at " + str(datetime.datetime.now()) 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print message
&amp;nbsp;&amp;nbsp;&amp;nbsp; mySqlFieldsToReturnList = ["OBJECTID",viewName&amp;nbsp; + ".TOID",viewName&amp;nbsp; + ".OFFICE_ID",viewName&amp;nbsp; + ".SEG_ID",viewName&amp;nbsp; + ".STL_NAME",viewName&amp;nbsp; + ".STR_NAME",viewName&amp;nbsp; + ".ST_CLASS",viewName&amp;nbsp; + ".ORIG_LVL",viewName&amp;nbsp; + ".DEST_LVL",viewName&amp;nbsp; + ".ONEWAY",viewName&amp;nbsp; + ".SPEED1",viewName&amp;nbsp; + ".SPEED2",viewName&amp;nbsp; + ".SPEED3",viewName&amp;nbsp; + ".SPEED4",viewName&amp;nbsp; + ".TRN_MODE",viewName&amp;nbsp; + ".BTH_MODE",viewName&amp;nbsp; + ".RESTR_ORI",viewName&amp;nbsp; + ".RESTR_DEST"]
&amp;nbsp;&amp;nbsp;&amp;nbsp; rdlkDict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(tableLayerName, mySqlFieldsToReturnList)}

#Would like to check the rdlkDict values here&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; message = "[INFO]&amp;nbsp; Looping through selected RoadNetwork started at " + str(datetime.datetime.now()) 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print message

&amp;nbsp;&amp;nbsp;&amp;nbsp; updateFieldsList = ["OBJECTID","SEG_ID","STL_NAME","STR_NAME","ST_CLASS", "ORIG_LVL","DEST_LVL","ONEWAY","SPEED1","SPEED2","SPEED3","SPEED4","TRN_MODE","BTH_MODE","RESTR_ORI","RESTR_DEST"]
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(FinalNetworkLayerName, updateFieldsList) as updateRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for updateRow in updateRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ObjectIDVal = updateRow[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentRow = currentRow + 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if currentRow%100 == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; message = "[INFO]&amp;nbsp; Processed " + str(currentRow) + " of " + str(RoadNetworkCount) + " rows at " + str(datetime.datetime.now())
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print message
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ObjectIDVal in rdlkDict:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[1] = rdlkDict[ObjectIDVal][3]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[2] = rdlkDict[ObjectIDVal][4]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[3] = rdlkDict[ObjectIDVal][5]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[4] = rdlkDict[ObjectIDVal][6]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[5] = rdlkDict[ObjectIDVal][7]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[6] = rdlkDict[ObjectIDVal][8]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[7] = rdlkDict[ObjectIDVal][9]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[8] = rdlkDict[ObjectIDVal][10]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[9] = rdlkDict[ObjectIDVal][11]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[10] = rdlkDict[ObjectIDVal][12]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[11] = rdlkDict[ObjectIDVal][13]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[12] = rdlkDict[ObjectIDVal][14]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[13] = rdlkDict[ObjectIDVal][15]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[14] = rdlkDict[ObjectIDVal][16]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[15] = rdlkDict[ObjectIDVal][17]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I interrogate values in rdlkDict and display each row of data so I can check whether the data dictionary is correctly populated?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:57:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313541#M24379</guid>
      <dc:creator>MarkWingfield</dc:creator>
      <dc:date>2021-12-11T14:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313542#M24380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you not just run the search cursor (and populate the dictionary) directly on 'fullViewName'? I'm unsure why you are creating a query table. Note there is a parameter for applying SQL expressions directly in the search cursor, although as I recall, maybe you can't use that parameter unless there is a valid (ESRI-recognized) OID field in the table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To interrogate values in a dictionary, access them by key. So for example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; sampleDict = {"cat": ("Meow Man", 23, 12.34), "dog": ("Bark Bark", 36, 1.432), "mouse":("Minnie Me", 3, 0.123)}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; sampleDict["dog"]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;("Bark Bark", 36, 1.432)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 15:23:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313542#M24380</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2014-05-29T15:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313543#M24381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks everybody. The data dictionary method was superfast and has definitely solved a very thorny problem. I did use makequerytable first to get the data into a layer i could interrogate in testing and then used this to populate the data dictionary. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All works very well&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 11:01:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313543#M24381</guid>
      <dc:creator>MarkWingfield</dc:creator>
      <dc:date>2014-05-30T11:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a feature layer with a global sql update</title>
      <link>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313544#M24382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks everybody. The data dictionary method was superfast and has definitely solved a very thorny problem. I did use makequerytable first to get the data into a layer i could interrogate in testing and then used this to populate the data dictionary. &lt;BR /&gt;&lt;BR /&gt;All works very well&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Given all the help that Chris and I gave you, you need to assign points and check the post with the best answer to your question.&amp;nbsp; See my signature line and click the link for details on assigning MVP points and answers.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 15:34:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-a-feature-layer-with-a-global-sql-update/m-p/313544#M24382</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2014-05-30T15:34:02Z</dc:date>
    </item>
  </channel>
</rss>

