I am new to Arcpy scripting, I need help on copying the features to SDE feature class.
My Scenario: We have 2 Geo databases running on Oracle 11g ArcSDE 10.2 . I have been asked to write the python script for query and copy the features from SDE connection1: Feature class1 to SDE connection2: Feature class2.
The feature classes are not identical. I need to copy Shape and only 2 attribute values feature class1 to feature class2 and also populate the remaining attribute values of feature class2 with constant values.
Please guide me in right direction to achieve this.
My Code till now:
# Import system modules
import arcpy
import os
import sys
try:
ParcelSAMNo = arcpy.GetParameterAsText(0)
ModeofQuery = arcpy.GetParameterAsText(1)
TransactionNo= arcpy.GetParameterAsText(2)
arcpy.env.workspace = r"C:Userschenna.kishoreAppDataRoamingESRIDesktop10.2ArcCatalogLIC.sdeLIC.LandPlan"
arcpy.env.overwriteOutput = True
fc = "LIC.LPLN_CADASTREPLOT"
where_clause = "PIN in (" + ParcelSAMNo + ")"
s_cursor = arcpy.da.SearchCursor(fc, ("SHAPE@", "PIN", "PDAREA"), where_clause)
arcpy.env.workspace = r"C:Userschenna.kishoreAppDataRoamingESRIDesktop10.2ArcCatalogSDE@REGEO.sdeSDE.Parcels"
outFc="SDE.RPAR_PD_Parcels"
with arcpy.da.InsertCursor(outFc,["PIN", "PAR_AREA", "SAM_NO", "TRANS_NO", "SHAPE@"]) as rowInserter:
for s_row in s_cursor:
# Insert the new row into the Parcel Layer
geom = s_row[0]
row_values = [str(s_row[1]), s_row[2], 0, int(TransactionNo), geom]
print row_values
rowInserter.insertRow(row_values)
#rowInserter.insertRow([str(s_row[1]), s_row[2], 0, int(TransactionNo), geom])
# Clean up the cursor
del rowInserter
del s_cursor
del s_row
except Exception as e:
print e.message
print "Success Full..!"
I cannot view the data that has been copied. But there is no errors from the script. Any Suggestions?
Thank in advance.