I create a script to append data from feature class in FGDB to SDE (MS Sql DBMS). I use "no_test" on append.
Script works fine, data get appended, but no attributes are transfered, just geometry. When I run the command manually, or if I set target to be another FGDB, it works.
Does anybody experienced this before?
After you manually run the tool the way it works copy the Python snippet from the Results window and compare the code with what you are using in your script. I'm sure it will contain information on the field mapping.
It's probably related to the field mapping from the file geodatabase to the SDE database.
Field mapping and Python scripting | ArcGIS Blog
As Xander suggests, if you copy the Python snippet from ArcMap it will include the field mapping you need
arcpy.Append_management(
inputs="some featureclass'",
target="some sde",
schema_type="NO_TEST",
field_mapping='a very long string of mapped attributes',
subtype=""
)
I don't think there is a problem in my field mapping. This are the reasons why:
I am wondering if it might be some issue with MS SQL. It is a first time I have experienced such a strange behaviour, and I did append many many times via scripting, however never against MS SQL.
How are you executing your code when not in the interactive Python window in ArcMap?
I am using Sublime text 3 to execute my code. But I think I also tried directly from command prompt. I did this operation 1000 times before. Please notice, that all the features are appended to target FC, just all attributes have value NULL.
Martin.
What version of ArcGIS are you using, and are there map services consuming the featureclasses that you are attempting to append to??
Hey Matthew.
I am using ArcGIS 10.5.1, and there are currently no Feature Classes consuming the services.
So I did some testing. Here is something interesting.
I have set up the input feature class in a way that I can append it with "TEST" value in "schema_type" parameter.
So it seems that there some kind of bug, when running append command from python script with "NO_TEST" as schema type against feature class in MS SQL SDE.
Anyone have any idea how to solve this issue?
CORRECTION TO ABOVE POST: