Share via

Azure Schema Registry Avro Encoder library for Python Samples

These are code samples that show common scenario operations with the Schema Registry Avro Encoder library.

Several Schema Registry Avro Encoder Python SDK samples are available to you in the SDK's GitHub repository. These samples provide example code for additional scenarios commonly encountered while working with Schema Registry Avro Encoder:

Prerequisites

  • Python 3.7 or later.
  • Microsoft Azure Subscription: To use Azure services, including Azure Schema Registry, you'll need a subscription. If you do not have an existing Azure account, you may sign up for a free trial or use your MSDN subscriber benefits when you create an account.

Setup

  1. Install the Azure Schema Registry Avro Encoder client library and Azure Identity client library for Python with pip:
pip install azure-schemaregistry-avroencoder azure-identity

Additionally, if using with azure.eventhub.EventData, install azure-eventhub>=5.9.0:

pip install azure-eventhub>=5.9.0
  1. Clone or download this sample repository
  2. Open the sample folder in Visual Studio Code or your IDE of choice.

Running the samples

  1. Open a terminal window and cd to the directory that the samples are saved in.
  2. Set the environment variables specified in the sample file you wish to run.
  3. Follow the usage described in the file, e.g. python encode_and_decode_event_data_message.py

Next steps

Check out the API reference documentation to learn more about what you can do with the Azure Schema Registry Avro Encoder library.