How to set the schema correctly based on the query text when using tMDMRestInput
When using the component tMDMRestInput, you can use the query language to narrow down the data records to be retrieved. Based on the query, you need to set the schema correctly for the retrieved data.
For more information about the MDM query language and REST data access, see https://help.talend.com/r/en-US/7.3/mdm-query-language.
You can also find more information about the MDM query language and REST data access in Talend Help Center (https://help.talend.com).
Query cases
-
When a query only counts how many results are returned by the query, you need to define one and only one column count in the schema.
-
When a query gets a metadata field, you need to define a column the same name as the metadata field in the schema.
-
When a query gets one or more fields, you need to define one or more columns whose names are the same as the returned fields in the schema.
-
When a query uses an alias, you need to define a column the same name as the alias field in the schema.
For example, if a query text gets the following fields, you need to define columns in the schema correspondingly: id, price, timestamp, taskid and productname.
"{
'select': {
'from': ['Product'],
'fields': [
{'field': 'Product/Id'},
{'field': 'Product/Price'},
{'metadata': 'timestamp'},
{'metadata': 'task_id'},
{'alias' : [{'name' : 'ProductName'}, {'field': 'Product/Name'}]}
]
}
}"