How to convert a string
to a int
data type in Azure Data Factory Data Flow
activity to set a parameter?
I have been trying to get a value from a json
file in a gen2 data lake:
{
"firstRow": {
"schema_name": "my_schema",
"table_name": "my_table",
"reserved_space_MB": 138.808,
"unused_space_MB": 1.392,
"data_space_MB": 136.848,
"index_space_MB": 0.568,
"row_count": 916300
},
...
}
But got this error in the last activty:
{
"errorCode": "InvalidTemplate",
"message": "The function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type",
"failureType": "UserError",
"target": "_split_file_from_table",
"details": ""
}
I have been following the documentation and also these stack overflow questions:
Azure Data Factory split file by file size
Convert Row Count to INT in Azure Data Factory
But I'm getting the same error no matter what I do.
How to reproduce
- Use a
Lookup
activity in a pipeline:
- start variable
table_size_var
as a string data type
Set Variable
activity to get thedata_space_MB
value:
@string(activity('read_json').output.firstRow.data_space_MB)
- Set parameter
table_size_mb
in aData Flow
:
- Set the value from the variable
table_size_var
to the parametertable_size_mb
:
@int(variables('table_size_var'))
- Run the pipeline - results: