- Introduction
- Tools Used
- Data Set
- Setting Up Azure Event Hub
- Setting Up Azure Stream Analytics
- Create an SQL Database
- Create a Table in the Database
- Run the Python Script on the Local Machine
- Perform Your Visualization with Power BI
This project is aimed at building a data ingestion pipeline for a transport dataset. The pipeline streams data from a local machine into Azure Event Hubs, uses Azure Stream Analytics to process this data in real-time, and stores it in an Azure SQL Database for further visualization using Power BI.
- Azure Event Hubs: For ingesting real-time streaming data.
- Azure Stream Analytics: For processing the streaming data in real-time.
- Azure SQL Database: For storing the processed data.
- Python: For scripting the data ingestion from the local machine.
- Power BI: For visualizing the stored data and uncovering insights.
The transport dataset contains various attributes related to transportation, such as transportation type, geographical name, race, timestamp, etc. You can find the file in the data folder above.
- Create a Namespace: Navigate to the Azure Portal, and create a new Event Hubs Namespace.
- Create an Event Hub: Inside the namespace, create an Event Hub.
- Get Connection String: Go to Shared access policies, create a new policy, and copy the connection string, save it somewhere for later as your Python script would need it to create a connection
- Create SQL Database: In the Azure Portal, create a new SQL Database.
- Configure Database: Set up the server, login credentials, and firewall rules to allow connections.
Navigate to the SQL Database created and use the SQL query window or SQL Server Management Studio to create a table that aligns with the data schema of the incoming data.

- Create a Stream Analytics Job: Navigate to Azure Portal and create a Stream Analytics job.
- Add Input: In the job topology, add an input and choose Azure Event Hub. Paste the connection string copied from the Event Hub setup.
- Create Output: In the job topology, add an output and select Azure SQL Database.
- Configure Output: Fill in the necessary details such as SQL Database credentials, table name, etc. once this is done write you query and start the job
Use a Python script to read the transport dataset and send events to the Azure Event Hub as messages.

Refresh your table to check if the messages are being streamed to your database
- Open Power BI Desktop: If you don’t have Power BI Desktop, you can download it here.
- Get Data: On the Home tab, click on "Get Data".
- SQL Server Database: In the Get Data window, select "SQL Server" and click on "Connect".
- Database Connection: Enter the server address and database details. Use the credentials set up earlier for the Azure SQL Database.
- Load Data: Select the table you have created and click on "Load".
- Drag and Drop Fields: Use the Fields pane to select the columns you want to visualize. Drag and drop them into the Values and Axis areas.
- Choose Visualization Type: Select the type of visualization you want (e.g., bar chart, line chart, map) from the Visualizations pane.
- Filter and Customize: Use filters to refine your visualization(the geographical location was used as a filter in this case) and the Format pane to customize the appearance.
