You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/event-hubs/event-hubs-capture-python.md
+13-10Lines changed: 13 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,17 @@
1
1
---
2
-
title: Read Azure Event Hubs captured data from a Python app (latest)
3
-
description: This article shows you how to write Python code to capture data that's sent to an event hub and read the captured event data from an Azure storage account.
2
+
title: 'Quickstart: Read Azure Event Hubs captured data (Python)'
3
+
description: This quickstart shows you how to write Python code to capture data that's sent to an event hub and read the captured event data from an Azure storage account.
4
4
ms.topic: quickstart
5
-
ms.date: 01/04/2021
5
+
ms.date: 03/14/2023
6
6
ms.devlang: python
7
7
ms.custom: mode-api
8
8
---
9
9
10
-
# Capture Event Hubs data in Azure Storage and read it by using Python (azure-eventhub)
10
+
# Quickstart: Capture Event Hubs data in Azure Storage and read it by using Python (azure-eventhub)
11
11
12
12
You can configure an event hub so that the data that's sent to an event hub is captured in an Azure storage account or Azure Data Lake Storage Gen 1 or Gen 2. This article shows you how to write Python code to send events to an event hub and read the captured data from **Azure Blob storage**. For more information about this feature, see [Event Hubs Capture feature overview](event-hubs-capture-overview.md).
13
13
14
-
This quickstart uses the [Azure Python SDK](https://azure.microsoft.com/develop/python/) to demonstrate the Capture feature. The *sender.py* app sends simulated environmental telemetry to event hubs in JSON format. The event hub is configured to use the Capture feature to write this data to Blob storage in batches. The *capturereader.py* app reads these blobs and creates an append file for each device. The app then writes the data into CSV files.
14
+
This quickstart uses the [Azure Python SDK](https://azure.microsoft.com/develop/python/) to demonstrate the Capture feature. The **sender.py** app sends simulated environmental telemetry to event hubs in JSON format. The event hub is configured to use the Capture feature to write this data to Blob storage in batches. The **capturereader.py** app reads these blobs and creates an append file for each device. The app then writes the data into CSV files.
15
15
16
16
In this quickstart, you:
17
17
@@ -32,13 +32,16 @@ In this quickstart, you:
32
32
- An Azure subscription. If you don't have one, [create a free account](https://azure.microsoft.com/free/) before you begin.
33
33
- An active Event Hubs namespace and event hub.
34
34
[Create an Event Hubs namespace and an event hub in the namespace](event-hubs-create.md). Record the name of the Event Hubs namespace, the name of the event hub, and the primary access key for the namespace. To get the access key, see [Get an Event Hubs connection string](event-hubs-get-connection-string.md#azure-portal). The default key name is *RootManageSharedAccessKey*. For this quickstart, you need only the primary key. You don't need the connection string.
35
-
- An Azure storage account, a blob container in the storage account, and a connection string to the storage account. If you don't have these items, do the following:
35
+
- An Azure storage account, a blob container in the storage account, and a connection string to the storage account. If you don't have these items, do the following steps:
36
36
1.[Create an Azure storage account](../storage/common/storage-account-create.md?tabs=azure-portal)
37
37
1.[Create a blob container in the storage account](../storage/blobs/storage-quickstart-blobs-portal.md#create-a-container)
38
-
1.[Get the connection string to the storage account](../storage/common/storage-configure-connection-string.md)
38
+
1.[Get the connection string to the storage account](../storage/common/storage-account-get-info.md#get-a-connection-string-for-the-storage-account)
39
+
39
40
40
41
Be sure to record the connection string and container name for later use in this quickstart.
41
-
- Enable the Capture feature for the event hub. To do so, follow the instructions in [Enable Event Hubs Capture using the Azure portal](event-hubs-capture-enable-through-portal.md). Select the storage account and the blob container you created in the preceding step. You can also enable the feature when you create an event hub.
42
+
43
+
## Enable Capture feature for the event hub
44
+
Enable the Capture feature for the event hub. To do so, follow the instructions in [Enable Event Hubs Capture using the Azure portal](event-hubs-capture-enable-through-portal.md). Select the storage account and the blob container you created in the preceding step. Select **Avro** for **Output event serialization format**.
42
45
43
46
## Create a Python script to send events to your event hub
44
47
In this section, you create a Python script that sends 200 events (10 devices * 20 events) to an event hub. These events are a sample environmental reading that's sent in JSON format.
@@ -86,7 +89,7 @@ In this section, you create a Python script that sends 200 events (10 devices *
86
89
[](./media/get-started-capture-python-v2/messages-portal.png#lightbox)
87
90
88
91
## Create a Python script to read your Capture files
89
-
In this example, the captured data is stored in Azure Blob storage. The script in this section reads the captured data files from your Azure storage account and generates CSV files for you to easily openand view. You will see 10 files in the current working directory of the application. These files will contain the environmental readings for the 10 devices.
92
+
In this example, the captured data is stored in Azure Blob storage. The script in this section reads the captured data files from your Azure storage account and generates CSV files for you to easily openand view. You see 10 files in the current working directory of the application. These files contain the environmental readings for the 10 devices.
90
93
91
94
1. In your Python editor, create a script called *capturereader.py*. This script reads the captured files and creates a filefor each device to write the data only for that device.
92
95
2. Paste the following code into *capturereader.py*.
@@ -176,7 +179,7 @@ In this example, the captured data is stored in Azure Blob storage. The script i
176
179
python capturereader.py
177
180
```
178
181
179
-
This capture processor uses the local directory to download all the blobs from the storage account and container. It processes any that are not empty, and it writes the results asCSV files into the local directory.
182
+
This capture processor uses the local directory to download all the blobs from the storage account and container. It processes files that aren't empty, and it writes the results as CSV files into the local directory.
180
183
181
184
## Next steps
182
185
Check out [Python samples on GitHub](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub/samples).
Copy file name to clipboardExpand all lines: articles/event-hubs/event-hubs-resource-manager-namespace-event-hub.md
+21-12Lines changed: 21 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,19 @@
1
1
---
2
-
title: 'Quickstart: Create an event hub with consumer group - Azure Event Hubs'
2
+
title: 'Quickstart: Create an Azure event hub with consumer group'
3
3
description: 'Quickstart: Create an Event Hubs namespace with an event hub and a consumer group using Azure Resource Manager templates'
4
4
ms.topic: quickstart
5
5
ms.custom: subject-armqs, mode-arm
6
6
ms.date: 06/08/2021
7
7
---
8
8
9
9
# Quickstart: Create an event hub by using an ARM template
10
-
11
-
Azure Event Hubs is a Big Data streaming platform and event ingestion service, capable of receiving and processing millions of events per second. Event Hubs can process and store events, data, or telemetry produced by distributed software and devices. Data sent to an event hub can be transformed and stored using any real-time analytics provider or batching/storage adapters. For detailed overview of Event Hubs, see [Event Hubs overview](event-hubs-about.md) and [Event Hubs features](event-hubs-features.md). In this quickstart, you create an event hub by using an [Azure Resource Manager template (ARM template)](../azure-resource-manager/management/overview.md). You deploy an ARM template to create a namespace of type [Event Hubs](./event-hubs-about.md), with one event hub.
If your environment meets the prerequisites and you're familiar with using ARM templates, select the **Deploy to Azure** button. The template will open in the Azure portal.
16
-
17
-
[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.eventhub%2Feventhubs-create-namespace-and-eventhub%2Fazuredeploy.json)
10
+
In this quickstart, you create an event hub by using an [Azure Resource Manager template (ARM template)](../azure-resource-manager/management/overview.md). You deploy an ARM template to create a namespace of type [Event Hubs](./event-hubs-about.md), with one event hub.
18
11
19
12
## Prerequisites
20
13
21
-
If you don't have an Azure subscription, [create a free account](https://azure.microsoft.com/free/) before you begin.
14
+
- If you don't have an Azure subscription, [create a free account](https://azure.microsoft.com/free/) before you begin.
15
+
- If you're new to Azure Event Hubs, see [Event Hubs overview](event-hubs-about.md) and [Event Hubs features](event-hubs-features.md).
16
+
22
17
23
18
## Review the template
24
19
@@ -35,9 +30,22 @@ To find more template samples, see [Azure Quickstart Templates](https://azure.mi
35
30
36
31
## Deploy the template
37
32
38
-
To deploy the template:
33
+
### Using Azure portal user interface
34
+
35
+
1. If your environment meets the prerequisites and you're familiar with using ARM templates, select the **Deploy to Azure** button. The template opens in the Azure portal.
36
+
37
+
[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.eventhub%2Feventhubs-create-namespace-and-eventhub%2Fazuredeploy.json)
38
+
2. Select an existing **resource group** or create a resource group and select it.
39
+
1. Select the **region**.
40
+
1. Enter a unique **name** for the **project**. This name is used to generate names for an Event Hubs namespace and an event hub in the namespace.
41
+
1. Select **Review + create**.
42
+
1. On the **Review + create** page, select **Create**.
43
+
44
+
### Using Azure Cloud Shell
45
+
46
+
To deploy the template using Azure Cloud Shell:
39
47
40
-
1. Select **Try it** from the following code block, and then follow the instructions to sign in to the Azure Cloud Shell.
48
+
1. Select **Open Cloud Shell** from the following code block, and then follow the instructions to sign in to the Azure Cloud Shell.
41
49
42
50
```azurepowershell-interactive
43
51
$projectName = Read-Host -Prompt "Enter a project name that is used for generating resource names"
@@ -55,6 +63,7 @@ To deploy the template:
55
63
56
64
1. Select **Copy** to copy the PowerShell script.
57
65
1. Right-click the shell console, and then select **Paste**.
0 commit comments