Hi, I have come across an issue with the "Truncate Table" geoprocessing tool (arcpy as well).
The error, "Truncation not allowed while editing" came up when I run the tool for a feature class in our organization's enterprise environment. Certainly, I was not activating Edit when the tool gave me the error as per pic below. I have also tried "Append" tool on the same data, and this tool worked fine.
After some investigations, I have found a possible cause for this error, which may be an AttributeRule. I configured the AttributeRule on a data, and it works totally fine to edit features (add, update, and delete manually as well as Append tool) on this data. What I have found is if AttributeRule is enabled on this data, Truncate Table tool returns the error whereas if AttributeRule is disabled on this data, Truncate Table works as expected.
Is this a bug in the Truncate table tool? Or is there any workaround?
Thanks in advance for your advice.
Solved! Go to Solution.
Did you try Delete Rows (alternate in some situations, to Truncate Table)
Delete Rows (Data Management)—ArcGIS Pro | Documentation
Did you try Delete Rows (alternate in some situations, to Truncate Table)
Delete Rows (Data Management)—ArcGIS Pro | Documentation
Thank you very much Dan!
I totally forgot the DeleteRows. This does not have any compatibility issue with AttributeRules configuration. Nonetheless, if the error returned by Truncatge Table is a bug, I would like ESRI to fix that up soon in the future.
I've spoken with ESRI about this very topic actually. The finding is indeed a bug:,
The Truncate Table tool fails when the dataset participates in a composite relationship class and in an enterprise geodatabase.
In my case, that turns out to be when attachment tables exist. I had never intentionally made a composite relationship class, but that's what "enable attachments" does automatically. Does that sound like your scenario?
Hi @ZachBodenner , thanks for your attention on this issue.
Thats very good to know that you already reported this issue.
My case is different from yours. This issue happens only when the AttributeRule is enabled. My AttributeRule establishes some relationships within the rule to achieve what I want.