0
votes

I'm trying to process the incoming data from the event hub, I need to process the data in a number of ways, so I'm creating multiple inputs and I need to map different inputs to different outputs for example, 1, I need to insert all the data into the blob. 2, I need to select very few columns and visualize those data in power bi in real-time. How To achieve this.

2

2 Answers

1
votes

The tricky part of this for me was getting multiple inputs into a single output. I was able to get this to work using the WITH statement and a UNION:

WITH combinedInput AS
(
    SELECT [col1], null AS [col2], 'FromSource1' AS [sourceTable]
    FROM [Source1]
    UNION
    SELECT [col1], [col2], 'FromSource2' AS [sourceTable]
    FROM [Source2]  
)
SELECT * 
INTO [outputLocation]
FROM combinedInput

To output this to multiple outputs you should be able tack on additional SELECT * INTO expressions to the end like this:

WITH combinedInput AS
(
    SELECT [col1], null AS [col2], 'FromSource1' AS [sourceTable]
    FROM [Source1]
    UNION
    SELECT [col1], [col2], 'FromSource2' AS [sourceTable]
    FROM [Source2]  
)
SELECT * 
INTO [outputLocation1]
FROM combinedInput
SELECT * 
INTO [outputLocation2]
FROM combinedInput
0
votes

Welcome to Stackoverflow!

The query (Azure Stream Analytics query language) design can express simple pass-through logic to move event data from one input stream into an output data store, or it can do rich pattern matching and temporal analysis to calculate aggregates over various time windows as in the Build an IoT solution by using Stream Analytics guide.

Note: You can join data from multiple inputs to combine streaming events, and you can do lookups against static reference data to enrich the event values. You can also write data to multiple outputs.

This article outlines solutions to several common query patterns based on real-world scenarios.

Queries in Azure Stream Analytics are expressed in a SQL-like query language. The language constructs are documented in the Stream Analytics query language reference guide.

Hope this helps.