Select to view content in your preferred language

Field Alias Automatic Generation - AGS 10.1 - SDE - Oracle

922
3
09-11-2012 09:13 AM
SchoppMatthieu
Deactivated User
Hello,

My knowledge is a little bit limited about sde / oracle and databases management so please forgive me if my question is not accurately defined or if my problem is too easy to solve.

I have an oracle database with three schemas. I can connect to these schemas using the ArcCatalog SDE connection (so they are "SDE enabled"). Then I have my sde features classes.

One of the schema contains a table referencing aliases for each field of each table and also the schema the table belongs to.

SCHEMA    TABLE     ALIAS
SCHEM1    TABL1     BLABLA1
SCHEM2    TABL2     BLABLA2

This as been implemented for something else but I'd like to use this information to automate the Aliases generation for my sde feature classes fields.

I don't have a clue how this could work. :confused:
Do I need to do it through a Python script from ArcGIS side?
Should I use sql developer (Oracle) ?

It would be awesome if someone could spend a few minutes to put me on the track.

Regards,
Matt
0 Kudos
3 Replies
SchoppMatthieu
Deactivated User
😞

What is the name of the class ?

No any help at all ?
0 Kudos
SchoppMatthieu
Deactivated User
Hello,

I've made some good progress but there is still something going wrong.

In python :

for featureClass in featureClasses:

fields = arcpy.ListFields(featureClass)

for f in fields:
if f.name == "ARI_ID":
f.aliasName = "ArianeID"

print f.name
print f.aliasName

(print)
ARI_ID
ArianeID

The alias has been updated apparently, however I can't see any changes in the "alias" of the field in my geodatabase.
When I print my "alias" in another function, the alias hasn't kept the changes:

for featureClass in featureClasses:
fields = arcpy.ListFields(featureClass)

for fieldF in fields:
if f.name == "ARI_ID":
print fieldF.aliasName

(print)
ARI_ID

Why the new alias hasn't been saved ?
0 Kudos
StevePeaslee
Deactivated User
Matshopp,

I do not believe that any geoprocessing methods are exposed that will allow a user to permanently change a geodatabase field alias. I'm not sure why, it seems like it would be a very useful geoprocessing tool. Hopefully someone else can tell me that I am incorrect.

For table aliases, you can use the arcpy.AlterAliasName(table, alias) method. I think this is new at 10.0.

In 9.x geodatabases, it was possible (but definitely NOT recommended) to alter aliases by editing the GDB_FieldInfo table. If done incorrectly you could trash the geodatabase so I won't go into further detail.

If you have experience with ArcObjects, you can use the esriGeodatabase.IClassSchemaEdit and AlterFieldAliasName methods. I have used this with ArcGIS 9.3 and MS SQL Server but haven't checked to see if these still apply at 10.x.


-Steve
0 Kudos