I have a model that converts shape files to a feature dataset in an existing database. I would like to either overwrite the existing feature classes in the db or delete them and perform the conversion. Which method is the most efficient and how do I do it?
v10.2
Solved! Go to Solution.
Unfortunately I don't know what to say.
I have it working (v. 10.1) and it looks just the same.
# Import arcpy module
import arcpy
# Load required toolboxes
arcpy.ImportToolbox("Model Functions")
# Local variables:
GDB_to_save_converted_FC = "C:\\temp\\NewGeodatabase.gdb"
Folder_with_shapefiles_to_convert = "C:\\temp"
FeatureClass = "C:\\temp\\XYbycode2.shp"
# Process: Iterate Feature Classes
arcpy.IterateFeatureClasses_mb(Folder_with_shapefiles_to_convert, "*.shp", "", "RECURSIVE")
# Process: Feature Class to Feature Class
arcpy.FeatureClassToFeatureClass_conversion(FeatureClass, GDB_to_save_converted_FC, "%Name%", "", "", "")
Micah's solution looks very good.
Hope you find the solution.
Enable the 'Overwrite the outputs of geoprocessing operations" option on Geoprocessing Options and then try.
Thanks but I have that option checked already. No luck
just in case...The data in that Feature Dataset should not have Locks on them, when you are replacing them.
The DB is not locked
Hello Asrujit,
I am having the same problem as Daniel, and I do not have an option of moving over to a python solution. It seems that there shold be a model builder solution. Maybe this is a bug? Or something in my settings? I've closed windows explorer, arcCatalog, and arcMap, then re-opened arcMap and validated my model and it still shows up as a white circle (not abnle to run) with the same error message.
Is there another way to triple check that ther eis no schema lock?
Any other ideas?
Thanks,
John
My problem was that it is a bug (ESRI tech support confirmed) and I could not perform my work flow with python it had to be done with model builder which worked. You can check the folders where the data you are manipulating resides and look for the schema lock file and manually delete it. It some cases the lock file does not get deleted. Are you sure you checked the overwrite geoprocessing files in the geoprocessing options setting?
Thanks Daniel.
Yes, I'm sure that box is checked. All my other models overwrite outputs fine.
Now I guess my decision is whether or not to try moving from 10.2 to 10.3 to see if the bug has been fixed...
If you are on maintenance call ESRI. They should fix it for you. At the time I needed a solution immediately and did not have the time to continue trouble shooting. Either way good luck.
Hi Daniel,
I am not on a maintenance call plan. But, I have good news though:
1) I decided to try upgrading from 10.2.1 to 10.2.2
2) when doing the install, it froze because a couple Arc programs were still runnning even though the Major Programs were closed, so it asked if it can close them first. I said yes, and it said it could not close them...so I rebooted, and then it was able to load 10.2.2
3) Now, I am not able to replicate the error!
a) not sure if it was the upgrade, or just that I needed to reboot the machine to remove the locks. It remains to be seen if the problem is truly fixed, we'll see....
Question for you: what version of 10.2 were you running when you had your problem?
Cheers,
John