Database Reference
In-Depth Information
import arcpy
sgdb_path = "c:/gdb/web"
sgdb_name = "Web_Bestaurants.gdb"
arcpy.CreateFileGDB_management(sgdb_path, sgdb_name)
Note
We didn't add the pause command because we will continue writing some code
after that.
3. Save the file and continue writing. Next, we need to copy the
Food_and_Drinks feature class from Bestaurants to the new geodatabase
as follows:
import arcpy
sgdb_path = "c:/gdb/web"
sgdb_name = "Web_Bestaurants.gdb"
arcpy.CreateFileGDB_management(sgdb_path, sgdb_name)
sfc_source = "c:/gdb/Bestaurants_new.gdb/
Food_and_Drinks"
sfc_dest = sgdb_path + "/" + sgdb_name +
"/Restaurants"
arcpy.CopyFeatures_management (sfc_source, sfc_dest)
4. Next, we need to delete a few fields that are not necessary for the web version of
the geodatabase. The RATING and DESCRIPTION fields should be deleted. We
terminate the script with a message, letting the user know that the process has
been completed. Add the following lines to your code:
import arcpy
sgdb_path = "c:/gdb/web"
sgdb_name = "Web_Bestaurants.gdb"
arcpy.CreateFileGDB_management(sgdb_path, sgdb_name)
sfc_source = "c:/gdb/Bestaurants_new.gdb/
Food_and_Drinks"
sfc_dest = sgdb_path + "/" + sgdb_name +
"/Restaurants"
#Copy features
arcpy.CopyFeatures_management (sfc_source, sfc_dest)
sfield_rating = "RATING"
Search WWH ::




Custom Search