-2

I am trying to copy entire gdb into new empty gdb. How should I proceed?

I tried this example:

# path to the cross-reference database

cross_ref_db = "C:/Program Files/ESRIDefenseMapping/Desktop10.2/Mgcp/DataConversion/MGCP_general_TRD30_GDB_to_MGCP_general_TRD30_GDB.mdb"

# the dataset mapping string

dataset_mapping = '10 | RoadL | RoadL |  | 0'

# source and target workspaces
source_workspace = "C:/data/Export_MGCP_TRD3.gdb"
target_workspace = "C:/data/mgcp_export.gdb"

# handle row level logging
logRowErrs = "NO_ROW_LEVEL_ERROR_LOGGING"

# exec the tool

arcpy.LoadData_production(cross_ref_db,source_workspace,target_workspace,dataset_mapping,logRowErrs)

But the LoadData_production doesn't work. I am using ArcGIS 10.6.1

How should I proceed?

1
  • 2
    Please Edit the question to specify the behavior of "doesn't work". Actual output and error messages are necessary.
    – Vince
    Mar 15, 2019 at 10:00

4 Answers 4

2

arcpy.Copy_management is a good option.

Another way to ensure an exact copy with an identical schema is to export and then import from an XML workspace. But this may take longer than arcpy.Copy_management.

ExportXMLWorkspaceDocument_management (in_data, out_file, {export_type}, {storage_type}, {export_metadata})

ImportXMLWorkspaceDocument_management (target_geodatabase, in_file, {import_type}, {config_keyword})

https://pro.arcgis.com/en/pro-app/tool-reference/data-management/export-xml-workspace-document.htm

1

If you are trying to simply copy data from one location to another you can use Feature Class to Geodatabase tool in the ArcMap interface or through a standalone script:

import arcpy
arcpy.env.workspace = 'C:/data.gdb'
arcpy.FeatureClassToGeodatabase_conversion(['climate', 'majorrds'],
                                       'C:/output/output.gdb')

http://desktop.arcgis.com/en/arcmap/10.6/tools/conversion-toolbox/feature-class-to-geodatabase.htm

1
  • This only works if there are no relationships between objects. For example if you have a feature class with coded value domains or relationship classes these will be lost. Arcpy.Copy_management copies the complete geodatabase schema intact. Sep 21, 2023 at 20:40
1

The LoadData tool is part of the Production Mapping extension. If you don't have that extension, you wont be able to use that tool.

If you task is to simply take the contents from one gdb and copy to another gdb, just use the Copy tool. It'll copy the entire contents of a gdb to another, new gdb.

in_data =  "C:/data/a1.gdb" 
out_data = "C:/data/z9.gdb"

arcpy.Copy_management(in_data, out_data)
-1

if you want to do it manually: go to arccatalog and right click on the new gdb and choose load data (if the new gdb do not have the same field name then you will have another screen asking you to choose the old field name and the corresponding new field name).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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