I'm trying to export a file geodatabase via the createReplica operation. I've tried both through the python API and the REST API directly (using requests) but both fail on my hosted feature layer due to an issue exporting the relationships for one of my layers...it does not give any more information then that. Does anyone know a possible fix or the root cause of it? I have an almost identical hosted feature layer I use for testing and this works with no issue on it so it must be something with the data but I can't figure out what.
The layer is Sync Enabled and here are the parameters I'm using:
# Using requests
data = {'f' : 'json',
'replicaName' : "pi_features_prd",
'layers' : layers,
'layerQueries': json.dumps(layer_queries),
'returnAttachments' : 'false',
'returnAttachmentsDatabyURL' : 'false',
'syncModel' : 'none',
'dataFormat' : 'filegdb',
'async' : 'true',
'token': token}
result = requests.post(replica_url, data=data).json()
# Using Python API
gis = GIS("https://arcgis.com", username, password)
fs_item = gis.content.get(item_id)
fc = FeatureLayerCollection.fromitem(fs_item)
sync_manager = SyncManager(fc)
result = sync_manager.create(
output_fgdb_name,
layers,
json.dumps(layer_queries),
return_attachments=True,
sync_model = 'none',
asynchronous=True,
wait=False,
attachments_sync_direction='bidirectional',
data_format='filegdb'
)
# the error
"""
replicaName': 'pi_features_prd', 'replicaID': '', 'submissionTime': 1661540514537, 'lastUpdatedTime': 1661540521653, 'status': 'Failed', 'error': {'code': 500,
'message': 'Unable to create replica. Please check your parameters.', 'details': ['Exporting relationships for layer 7 failed.']}}
"""