Renaming SDE feature classes

1126
3
10-15-2012 11:45 AM
KevinYanuk
Occasional Contributor
Hello -

When renaming a featureclass in an SDE db, do I have to include the full name?  ex:

for fc in fcList:
    arcpy.Rename_managemant(fc,"new_name")


or

for fc in fcList:
    arcpy.Rename_managemant(fc,"DATABASE_NAME.new_name")


Thanks
Tags (2)
0 Kudos
3 Replies
T__WayneWhitley
Frequent Contributor
No.  You can set the env workspace to your SDE connection.

And by the way, it's 'management'.
0 Kudos
KevinYanuk
Occasional Contributor
No.  You can set the env workspace to your SDE connection.

And by the way, it's 'management'.


Great thanks -

and oops 😛


EDIT:

This has happened to me before -- it hangs up on arcpy.Rename_management() and doesn't work when trying to do this on SDE.

I can always use C# or something, but this only took a few minutes to throw together, I don't know why it hangs up.
0 Kudos
T__WayneWhitley
Frequent Contributor
Yes I know what you mean...testschemalock only served to let you know if you could acquire a lock (necessary to change the name, delete, add fields, etc.), and then it didn't always seem to work.  Now, it appears there is a more potent arsenal with arcpy I haven't tried yet- you can supposedly target and disconnect users (as an admin):
http://resources.arcgis.com/en/help/main/10.1/index.html#/DisconnectUser/018v00000061000000/
0 Kudos