Test Stream Analytics queries locally with sample data using Visual Studio Code
You can use Azure Stream Analytics tools for Visual Studio Code to test your Stream Analytics jobs locally with sample data. You can find the query results in JSON files in the LocalRunOutputs folder of your project.
For more information, see Overview of local Stream Analytics runs in Visual Studio Code with ASA Tools.
Install .NET core SDK and restart Visual Studio Code.
Use this quickstart to learn how to create a Stream Analytics job using Visual Studio Code.
Prepare sample data
You need to prepare sample input data files first. If you already have some sample data files on your machine, you can skip this step and move on to the next one.
Click Preview data in your input configuration file from the top line. Some input data will be fetched from IoT Hub and shown in the preview window.
Once the data is shown, click Save as to save the data to a local file.
Define a local input
Click input.json under Inputs folder in your Stream Analytics project. Then select Add local input from the top line.
You can also use Ctrl+Shift+P to open the command palette and enter ASA: Add Input.
Select Local Input.
Select + New Local Input.
Enter the same input alias that you used in your query.
In the newly generated LocalInput_Input.json file, enter the file path where your local data file is located.
Select Preview Data to preview the input data. The serialization type for your data is automatically detected if its JSON or CSV. Use the selector to view your data in Table or Raw format. The following table is an example of data in the Table format:
The following table is an example of data in the Raw format:
Run queries locally
Return to your query editor, and select Run locally. Then select Use local input from the dropdown list.
The result is shown in the right window. You can click Run to test again. You can also select Open in folder to see the result files in file explorer and further open them with other tools. The result files are only available in JSON format.
- Overview of local Stream Analytics runs in Visual Studio Code with ASA Tools
- Test Stream Analytics queries locally against live stream input by using Visual Studio Code
- Explore Azure Stream Analytics jobs with Visual Studio Code (preview)
- Set up CI/CD pipelines and unit testing by using the npm package
Submit and view feedback for