GetMetadataPropertyValue
Published: March 1, 2017
Updated: March 1, 2017
Queries input data for specific properties. There are three types of properties, Adapter, User, and Unique EventId Properties.
Certain input specific properties have been made accessible by GetMetadataPropertyValue function. Additionally, all properties can be accessed as a single record.
For example, |
Examples
To query from an Event Hub input;select GetMetadataPropertyValue(ehInput, '[EventHub].[EventEnqueuedUtcTime]') as mytime from ehInput
To query from an IoT Hub input;select GetMetadataPropertyValue(iotInput, 'IoTHub.StreamId') as iotStreamId from iotInput
To query all adapter related properties as a record;
For Event Hub:select GetMetadataPropertyValue(ehInput, 'EventHub') as myEHPropertiesRecord from ehInput
For IoT Hub:select GetMetadataPropertyValue(iotInput, 'IoTHub') as iotRecord from iotInput
For Blob input:select GetMetadataPropertyValue(blobInput, 'Blob') as blobRecord from blobInput
A custom user property called SenderClientId set on incoming EventHub/IoT/Blob messages will be accessible as shown below.
Examples
To query from an Event Hub input;select Name, GetMetadataPropertyValue(ehInput, '[User].[SenderClientId]') from ehInput
To query from an IoT Hub input;select Name, GetMetadataPropertyValue(iotInput, '[User].[SenderClientId]') from iotInput
To query from a Blob input;select Name, GetMetadataPropertyValue(blobInput, '[User].[SenderClientId]') from blobInput
To get all user properties as a record;
For Event Hub:select Name, GetMetadataPropertyValue(ehInput, '[User]') as userprops from ehInput
For IoT Hub:select Name, GetMetadataPropertyValue(iotInput, '[User]') as userprops from iotInput
For Blob input:select Name, GetMetadataPropertyValue(blobInput, '[User]') as userprops from blobInput
Creates a unique id (Guid) for an input event, which can be useful for primary key purposes. It is consistent (not random) i.e., Stream Analytics will produce the same id for an event, if you go back in time and re-read the same input event.
Example
select GetMetadataPropertyValue(ehInput, 'EventId') as eventPrimaryKey from ehInput