Skip to main content
3 of 3
updated code
its30
  • 567
  • 4
  • 24

Trying to copy features from an in_memory table to feature table

i just want to write the in_memory table to a table in a .gdb

import arcpy
from arcpy import env
import os
import sys
scriptPath = sys.path[0]
thisFolder = os.path.normpath(os.path.dirname(scriptPath))
env.workspace = os.path.join(thisFolder, "AdminReport", "Workspace")

#get variables
...code here..

#create Table
print("Creating Table...")
tempTable = arcpy.CreateTable_management("in_memory", "tempTable")
arcpy.AddField_management(tempTable, "Parcel_FID", "LONG")
arcpy.AddField_management(tempTable, "Plan_Acres", "DOUBLE")
arcpy.AddField_management(tempTable, "Pres_Acres", "DOUBLE")
arcpy.AddField_management(tempTable, "Conf_Region", "TEXT", field_length=25)
arcpy.AddField_management(tempTable, "Conf_Date", "TEXT", field_length=25)
arcpy.AddField_management(tempTable, "Center_Zone", "TEXT", field_length=25)
arcpy.AddField_management(tempTable, "Center_Muni", "TEXT", field_length=25)

#calculate values for each field
row = arcpy.InsertCursor(tempTable).newRow()
row.setValue("Parcel_FID", objectID)
row.setValue("Plan_Acres", planAcres)
row.setValue("Pres_Acres", presAcres)
row.setValue("Conf_Region", confRegion)
row.setValue("Conf_Date", confDate)
row.setValue("Center_Zone", centerZone)
row.setValue("Center_Muni", centerMuni)
del row

#Output Table to GDB
arcpy.TableToTable_conversion(tempTable, "Workspace.gdb", "outTable")

No errors but I am geting an empty table generated.

its30
  • 567
  • 4
  • 24