The CDC_SET_METADATA function specifies the value or content of the OPTIONS metadata user_data header tag associated with JSON or AVRO target datastores ONLY. The value once assigned, will remain and be used for every AVRO or JSON record written unless or until it is changed.
Category
Change Data Capture
Syntax
CDC_SET_METADATA(user_data, data_string)
Parameters and Descriptions
Parameter | Description |
---|---|
user_data | The default name of the METADATA header tag. |
data_string | The data string in character format. The data string can be a field from a source datastore, a variable, a constant or the result of another Function. |
Example 1
Set the value of the user_data Header tag:
CDC_SET_METADATA(user_data,’My Content’) --sets to ‘My Content’
CDC_SET_METADATA(user_data, CALL(F_HIVE_TIMESTAMP,CDCTSTMP(CDCIN))) --sets to a hive formatted timestamp
CDC_SET_METADATA(user_data,RIGHT(CDC_METADATA(OBJECT_NAME),4)) --sets to the right 4 chars of the object_name.