Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have 150+ feature classes in SDE for which I need to create an empty feature class in a file geodatabase. For these feature classes I need to import the attributes and the name of the feature class as in SDE. I tried to export to an XML workspace document but it is not working because of some error on the SDE and I'm not an SDE administrator, so I am unable to modify the things on the SDE.

An alternative to this that I tried was creating a script in Python for creating the feature class. I get the names of the feature class from the SDE but am unable to create them on the local SDE.

Also how can I read the geometry type for the feature class in arcpy?

Here is the code I've written:

import arcpy
arcpy.env.workspace= r"C:\Users\088927\AppData\Roaming\ESRI\Desktop10.0\ArcCatalog\ENT-QA @ sample.sde"
fcList = arcpy.ListFeatureClasses('sde."ENT-QA".*',"","")
output = "C:/Users/088927/Desktop/Schema.gdb"
for fc in fcList:
    fullName = arcpy.ParseTableName(fc)
    #fcTemplate = fc.
    finallist = []
    nameList = fullName.split(",")
    databaseName=nameList[0]
    ownerName = nameList[1]
    fcName = nameList [2]
    fcStr = str(fcName)
    print fcStr
    arcpy.CreateFeatureclass_management(r"C:\Users\abc\Desktop\Schema.gdb",fcstr)

Any help regards this matter is highly appreciated. Thank a lot in advance.

share|improve this question
    
Please consider improving your accept rate by accepting answers to your previous questions. Many users of this site will be more inclined to answer questions from users with high accept rates. –  blah238 Apr 27 '12 at 21:30
    
What error did you get when you attempted to export to an XML workspace document, and what options did you set on the export dialog? –  blah238 Apr 27 '12 at 21:33
    
How would I accept answers. What should I do I didnt know anything about. Thanks for letting me know @blah238 –  Ramakrishna Billakanti Apr 27 '12 at 21:33
    
See the "accepting answers" link in my comment. –  blah238 Apr 27 '12 at 21:34
    
Hi @blah238 I'm getting an error for unable to create an XML because of some layers got corrupted on the SDE. As you asked me to accept the previous answers I did go checked dthe button for the answer it is not there on my quesitions. Do I need to activate anything before I see that button on my questions. Thanks. –  Ramakrishna Billakanti Apr 27 '12 at 21:42
show 1 more comment

1 Answer 1

up vote 2 down vote accepted

Short of being able to figure out why you cannot export an XML schema from SDE, there is a quick and dirty method you might try. This will depend on if you have enough space and privileges.
1. Create an empty file geodatabase.
2 . Use the copy featureclass tool with the batch option to copy all 150 featureclasses from the SDE geodatabase to your empty file geodatabase.
3. Set up a python script to cycle through all the featureclasses and run the delete features tool on each of them.

Assuming this works, it should leave you with a file geodatabase that contains all of the empty featureclasses from SDE with all the attribute fields and even the domains and relationship classes if they were defined.

It is definitely clunky, but I've also run across a schema that would not export to an xml workspace due to errors in the schema.

As for your other question, you might check out this help topic on working with geometries It should at least get you on the right track. It may also help to post that as a separate question, or search to see if it has already been asked.

Good luck!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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