MauroDataMapper / mdm-core

The backend of MDM
Apache License 2.0
6 stars 3 forks source link

JSON DataFlow importer 3.0 not working in Mauro 6.4.0 #131

Closed OCC-MarkTolley closed 2 years ago

OCC-MarkTolley commented 3 years ago

Describe the bug A dataflow import test that was previously working is now failing with the latest released version of Mauro.

To Reproduce

  1. Create two multi-level data models
  2. Create a JSON defining a dataflow between them
  3. Call the JSON dataflow importer API JSON import fails with error similar to

POST: 400 BadRequest: {"status":400,"reason":"Bad Request","errorCode":"DCCI01","message":"Source DataClass retrieval for dm:DataSource1_Origin$main|dc:dbo|dc:table1 failed","path":"/api/dataModels/c6e3184e-9445-45bb-bc4b-0ce3dc1892ad/dataFlows/import/uk.ac.ox.softeng.maurodatamapper.dataflow.provider.importer/

The $main appendage in the datamodel definition appears to be new and may be the source of the problem

Expected behavior Import should succeed.

Screenshots Data model structure looks like the following: image

Desktop (please complete the following information):

Smartphone (please complete the following information): N/A

Additional context JSON import is the following: { "dataFlow": { "source": { "id": "16b48194-be21-4e00-8a06-2be3c346b78b", "label": "DataSource1_Origin", "type": "Data Asset" }, "target": { "id": "c6e3184e-9445-45bb-bc4b-0ce3dc1892ad", "label": "DataSource1_Raw", "type": "Data Asset" }, "dataClassComponents": [ { "definition": "dbo to raw1 table", "sourceDataClasses": [ { "label": "dbo|dc:table1", "description": "dbo.table1", "type": "Data Asset" } ], "targetDataClasses": [ { "label": "raw1|dc:table1", "description": "raw1.table1", "type": "Data Asset" } ], "dataElementComponents": [ { "sourceDataElements": [ { "dataClass": { "label": "dbo|dc:table1", "type": "Data Asset" }, "label": "id", "type": "Data Asset" } ], "targetDataElements": [ { "dataClass": { "label": "raw1|dc:table1", "type": "Data Asset" }, "label": "id", "type": "Data Asset" } ], "definition": "id column mapping", "label": "transform unchanged", "description": "id column mapping", "type": "Data Asset" }, { "sourceDataElements": [ { "dataClass": { "label": "dbo|dc:table1", "type": "Data Asset" }, "label": "col1", "type": "Data Asset" } ], "targetDataElements": [ { "dataClass": { "label": "raw1|dc:table1", "type": "Data Asset" }, "label": "col1", "type": "Data Asset" } ], "definition": "col1 column mapping", "label": "transform unchanged", "description": "col1 column mapping", "type": "Data Asset" } ], "label": "dbo.table1 to raw1.table1", "type": "Data Asset" } ], "label": "DataSource1_Origin to DataSource1_Raw", "description": "", "type": "Data Asset" } }

OCC-MarkTolley commented 3 years ago

I get the same issue with simplified JSON that doesn't include any DataElementComponents: { "dataFlow": { "source": { "id": "7aac42a6-9d2b-499f-a80b-494dd3aa88a3", "label": "DataSource1_Origin", "type": "Data Asset" }, "target": { "id": "8fbbcb3e-d5f9-477d-97b4-a0ff78f62e0b", "label": "DataSource1_Raw", "type": "Data Asset" }, "dataClassComponents": [ { "definition": "dbo to raw1 table", "sourceDataClasses": [ { "label": "dbo|dc:table1", "description": "dbo.table1", "type": "Data Asset" } ], "targetDataClasses": [ { "label": "raw1|dc:table1", "description": "raw1.table1", "type": "Data Asset" } ], "dataElementComponents": [], "label": "dbo.table1 to raw1.table1", "type": "Data Asset" } ], "label": "DataSource1_Origin to DataSource1_Raw", "description": "", "type": "Data Asset" } }

Error returned is: Error in Mauro POST: 400 BadRequest: {"status":400,"reason":"Bad Request","errorCode":"DCCI01","message":"Source DataClass retrieval for dm:DataSource1_Origin$main|dc:dbo|dc:table1 failed","path":"/api/dataModels/3a8c83de-4b37-480e-9c85-f55ca97115fa/dataFlows/import/uk.ac.ox.softeng.maurodatamapper.dataflow.provider.importer/DataFlowJsonImporterService/3.0","devMode":false,"version":"4.8.0"}

OCC-MarkTolley commented 3 years ago

Talked to Anthony - he reckons that the problem may be the hardcoded version number in this file: https://github.com/MauroDataMapper/mdm-core/blob/develop/mdm-plugin-dataflow/grails-app/services/uk/ac/ox/softeng/maurodatamapper/dataflow/provider/importer/DataFlowJsonImporterService.groovy

olliefreeman commented 3 years ago

we need to update the XSD/XML and JSON to accept "path" not "label" for the DC component, then we use the FQ path to find the DC inside the relevant DM