3

Second title: "Is arcpy.ValidateTableName broken on Oracle?"

I have an Oracle SDE database 9.3.1 (service connection). My arcGIS client tools are version 10.0 SP5). I have some names of feature classes(fc) that I would like create.

I want to make sure that the name of the feature class is valid before I create it so I use the arcpy.ValidaTableName function.

However when I try to validate a long fc I do NOT get a valid table name for Oracle (Oracle has a table identifier character limit on 30).

import arcpy
oracleWorkspace = "F:\shr016\all_is_sde_databases\esri_mogpros_5167_gisowner.sde"

print arcpy.ValidateTableName("very_long_table_name_with_too_many_characters_for_an_oracle_database", oracleWorkspace)

# prints: very_long_table_name_with_too_many_characters_for_an_oracle_database

Is there way I can validate table names on SDE with a Oracle backend?

Update

It seems like this feature is indeed not working correctly.

Esri support writes in an email:

I have tested with arcpy.ValidateTableName with an Oracle database and it does behave as you have mentioned in your previous email. Currently, I am not aware of any alternate way of checking if the feature class name is valid from the Oracle side. I will be investigating this issue further and will update you with my findings.

Update 2

Esri support has followed up:

This tool was designed to check for naming conventions, i.e. presence of any invalid characters or use of any reserverd keywords specific to the RDBMS being used. For checking the character length, I am contemplating logging an enhancement request. In the meantime you could include something like the following in your script to make sure the table name does not exceed 30 characters:

import string, os

test = "tableName"
oracleWorkspace = "F:\shr016\all_is_sde_databases\esri_mogpros_5167_gisowner.sde"

if len(test) <=30:
  print arcpy.ValidateTableName(test, oracleWorkspace) 
else:
   print "Invalid table name"

Conclusion:

If you need a function that returns a valid table name for an Oracle SDE table name you have to write it yourself.

Update 3

A final update from esri support which confirms the conclusion:

I have logged an enhancement request for this incident: NIM090928-arcpy.ValidateTableName should check that table names do not exceed the workspace's maximum number of characters.

2
  • I've always found backward compatibity (Newer version of ArcGIS Desktop connecting to older SDE) to be flaky. Maybe that is the cause? Commented Apr 17, 2013 at 5:41
  • @DevdattaTengshe I have tried with arcsde 10.0 connection with the same result, so the backwards compatibility is not the problem. (not the only problem at least.) Commented Apr 18, 2013 at 14:41

1 Answer 1

5

It looks like you are hitting a known issue.

NIM034235 IFieldChecker.ValidateTableName should check that table names do not exceed the workspace's maximum number of characters.

mackayj80 describes the issue in this Esri blog post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.