Skip to main content
updated code
Source Link
its30
  • 567
  • 4
  • 24

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")

#Create#get variables
...code here..

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

#calculate values for each field
row = arcpy.CopyFeatures_managementInsertCursor(outTabletempTable).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")

getting this error:No errors but I am geting an empty table generated.

arcpy.CopyFeatures_management(outTable, "outTable") ERROR 000732: Input Features: Dataset in_memory\outTable does not exist or is not supported

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")

#Create Table
outTable = arcpy.CreateTable_management("in_memory", "outTable")
arcpy.AddField_management(outTable, "Parcel_FID", "SHORT")
arcpy.AddField_management(outTable, "Plan_Acres", "DOUBLE")
arcpy.AddField_management(outTable, "Pres_Acres", "DOUBLE")
arcpy.AddField_management(outTable, "Conf_Region", "TEXT", field_length=25)
arcpy.AddField_management(outTable, "Conf_Date", "TEXT", field_length=25)
arcpy.AddField_management(outTable, "Center_Zone", "TEXT", field_length=25)
arcpy.AddField_management(outTable, "Center_Muni", "TEXT", field_length=25)
arcpy.CopyFeatures_management(outTable, "outTable")

getting this error:

arcpy.CopyFeatures_management(outTable, "outTable") ERROR 000732: Input Features: Dataset in_memory\outTable does not exist or is not supported

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.

edited tags
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Source Link
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")

#Create Table
outTable = arcpy.CreateTable_management("in_memory", "outTable")
arcpy.AddField_management(outTable, "Parcel_FID", "SHORT")
arcpy.AddField_management(outTable, "Plan_Acres", "DOUBLE")
arcpy.AddField_management(outTable, "Pres_Acres", "DOUBLE")
arcpy.AddField_management(outTable, "Conf_Region", "TEXT", field_length=25)
arcpy.AddField_management(outTable, "Conf_Date", "TEXT", field_length=25)
arcpy.AddField_management(outTable, "Center_Zone", "TEXT", field_length=25)
arcpy.AddField_management(outTable, "Center_Muni", "TEXT", field_length=25)
arcpy.CopyFeatures_management(outTable, "outTable")

getting this error:

arcpy.CopyFeatures_management(outTable, "outTable") ERROR 000732: Input Features: Dataset in_memory\outTable does not exist or is not supported