AnsweredAssumed Answered

Insert Cursor to Table In Memory

Question asked by clintoncooper on Oct 31, 2013
Latest reply on May 14, 2014 by bixb0012
I am trying to take a large dataset and import (export or append) it into an "in memory" table where I can then run the calculations:  I need to import three fields ( SOS_VOTERID, FEAT_SEQ and YEAR_Of_BIRTH).  For my code below, I am just working with 2.  I believe I need to run a search cursor on my orig table, and then run an insert cursor to import the data into my new table.  I am running into an error that says:

Runtime error  Traceback (most recent call last):   File "<string>", line 23, in <module> TypeError: sequence size must match size of the row 


import arcpy, collections  from arcpy import env env.workspace = r"C:\Users\cc1\Desktop\NEW.gdb\WAYNE" table = "WAYNE"  table2 = arcpy.CreateTable_management("in_memory", "WAYNE") arcpy.AddField_management(table2, "SOS_VOTERID","TEXT", field_length=25) arcpy.AddField_management(table2, "FEAT_SEQ","LONG")  newList = {row[0]: row[1] for row in arcpy.da.SearchCursor(table, ["SOS_VOTERID","FEAT_SEQ"])}                                         tbl = arcpy.ListTables("*")                       for table in tbl:     fieldList = arcpy.ListFields(table)     for field in fieldList:         newList.append([table,field.name])    #  this populates the new list with table and field to directly insert to new table with arcpy.da.InsertCursor(table2, ['SOS_VOTERID', 'FEAT_SEQ']) as insert:     for f in newList:                                          insert.insertRow(f) del insert 


Anyone know where I am going wrong?  Thanks!

Clinton

Outcomes