AnsweredAssumed Answered

Import XML Workspace Document Fails from ArcPy

Question asked by Arthur.Smith_PDCE on Feb 13, 2019
Latest reply on Mar 5, 2019 by ngoorman

I am trying to use the distributed geodatabase tools to archive an SDE database to a file geodatabase on a monthly basis.  Workflow is to Export XML Workspace Document from SDE, then Import XML Workspace Document to .gdb.  This works fine in ArcMap, but returns an error from ArcPy.  I tried creating a ModelBuilder to do this, which works fine, but once exported to ArcPy, fails.

 

Has anyone else run across this issue?  Any ideas on a fix?  Thanks in advance!

 

Error:

Failed to execute. Parameters are not valid.
ERROR 001162: Invalid XML file.
Failed to execute (ImportXMLWorkspaceDocument).

 

Code:

# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# XML_from_ModelBuilder.py
# Created on: 2019-02-12 08:57:39.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------

# Set the necessary product code
import arceditor


# Import arcpy module
import arcpy


# Local variables:
Connection_to_arcdb__DJ_operations__sde = "Database Connections\\Connection to arcdb (DJ_operations).sde"
DJ_XML_TEST_zip = "C:\\GIS\\SDE_Archive\\DJ_XML_TEST.zip"
DJ_XML_TEST_gdb = "C:\\GIS\\SDE_Archive\\DJ_XML_TEST.gdb"
DJ_XML_TEST_gdb__2_ = DJ_XML_TEST_gdb
DJ_XML_TEST_zip__2_ = "C:\\GIS\\SDE_Archive\\DJ_XML_TEST.zip"

# Process: Export XML Workspace Document
arcpy.ExportXMLWorkspaceDocument_management(Connection_to_arcdb__DJ_operations__sde, DJ_XML_TEST_zip, "DATA", "BINARY", "METADATA")

# Process: Import XML Workspace Document
arcpy.ImportXMLWorkspaceDocument_management(DJ_XML_TEST_gdb, DJ_XML_TEST_zip__2_, "DATA", "")

Outcomes