Using Python to Upgrade Metadata

2491
2
07-31-2013 09:07 AM
DavidDenham
Occasional Contributor
I am trying to use python to allow users to select a SDE connection as their workspace and select the dataset they want to upgrade.  Then the script will upgrade the dataset's metadata, loop through the feature classes in the dataset and upgrade the metadata for each of the feature classes.  I am not getting any error messages, but the metadata is not upgrades and the tool is not running for that long. 

import arcpyarcpy.env.workspace = arcpy.GetParameterAsText (0)
DatasetName = arcpy.GetParameterAsText (1)
print DatasetName
arcpy.UpgradeMetadata_conversion (DatasetName, "FGDC_TO_ARCGIS")
fcList = arcpy.ListFeatureClasses ("*","",DatasetName)
for fc in fcList:
    print fc
        arcpy.UpgradeMetadata_conversion (fc, "FGDC_TO_ARCGIS")


    


Tags (2)
0 Kudos
2 Replies
CalinArens
New Contributor II

I am running into similar problems. Did you ever figure out the problem?

0 Kudos
DavidDenham
Occasional Contributor

Sorry about not replying sooner, but I did not check on my post.  I did figure out a solution, but I cheated and used model builder.  Here is the python version of the tool:


# Import arcpy module
import arcpy
# Load required toolboxes
arcpy.ImportToolbox("Model Functions")


# Script arguments
Select_Feature_Dataset = arcpy.GetParameterAsText(0)


# Local variables:
Feature_Dataset = Select_Feature_Dataset
FeatureClass__2_ = "\\FeatureClass"
FeatureClass = FeatureClass__2_
Name = "FeatureClass"


# Process: Iterate Feature Classes
arcpy.IterateFeatureClasses_mb(Select_Feature_Dataset, "*", "", "NOT_RECURSIVE")


# Process: Upgrade Feature Class(es) Metadata
arcpy.UpgradeMetadata_conversion(FeatureClass__2_, "FGDC_TO_ARCGIS")


# Process: Upgrade Dataset Metadata
arcpy.UpgradeMetadata_conversion(Select_Feature_Dataset, "FGDC_TO_ARCGIS")
0 Kudos