SQL field name limit - arcpy.ValidateFieldName and error "Attribute column not found"

386
1
07-24-2019 02:36 PM
BarbaraS
Occasional Contributor

I am working on adapting a script for filling in field values in existing features, previously used in ArcMap, now transitioning to ArcGIS Pro, using a SQL database. The adapted script throws me the error "Attribute column not found". I tried then to validate my field name and was confronted with a character limit. A field name with more than 10 characters is returned with just 10 characters.

arcpy.ValidateFieldName("abcdefghijklmnopq",workspace)
'abcdefghij'

So, now how do I find my way around that limitation? I have several field names, that are longer than 10 characters and I won't be able to shorten them. Is this a setting in the database itself? Or what do take that into consideration in my code? What am I missing here?

0 Kudos
1 Reply
RandyBurton
MVP Alum

What is the workspace? 

If the optional workspace is not specified, the field name is validated against the current workspace

Are you wanting to create a new field and validate a name you are planning to use?  Or did you want to use something like ListFields to verify that a certain field exists? 

0 Kudos