-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[Schema Registry] bug bash docs #21457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4ab03e7
update version
swathipil caa88b9
update dependencies
swathipil 2205b58
more changes
swathipil 1e2a129
update core dep after release
swathipil 26f63de
updates
swathipil 1395546
update readme
swathipil 25e4644
fix more
swathipil 3ba7ae3
samples
swathipil 6634676
docstring
swathipil ce01c16
Merge branch 'main' into swathipil/sr/bug-bash-doc
swathipil ab6e922
adams comments
swathipil e96744d
bug bash 2: pt 1
swathipil a74699c
rakshith/adam comments
swathipil f98105f
adam nit
swathipil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,10 +14,10 @@ _Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For | |
|
|
||
| ### Install the package | ||
|
|
||
| Install the Azure Schema Registry client library and Azure Identity client library for Python with [pip][pip]: | ||
| Install the Azure Schema Registry client library for Python with [pip][pip]: | ||
|
|
||
| ```Bash | ||
| pip install azure-schemaregistry azure-identity | ||
| pip install azure-schemaregistry | ||
| ``` | ||
|
|
||
| ### Prerequisites: | ||
|
|
@@ -27,7 +27,23 @@ To use this package, you must have: | |
| * Python 2.7, 3.6 or later - [Install Python][python] | ||
|
|
||
| ### Authenticate the client | ||
| Interaction with Schema Registry starts with an instance of SchemaRegistryClient class. You need the fully qualified namespace and AAD credential to instantiate the client object. | ||
|
|
||
| Interaction with Schema Registry starts with an instance of SchemaRegistryClient class. The client constructor takes the fully qualified namespace and an Azure Active Directory credential: | ||
|
|
||
| * The fully qualified namespace of the Schema Registry instance should follow the format: `<yournamespace>.servicebus.windows.net`. | ||
|
|
||
| * An AAD credential that implements the [TokenCredential][token_credential_interface] protocol should be passed to the constructor. There are implementations of the `TokenCredential` protocol available in the | ||
| [azure-identity package][pypi_azure_identity]. To use the credential types provided by `azure-identity`, please install the Azure Identity client library for Python with [pip][pip]: | ||
|
|
||
| ```Bash | ||
| pip install azure-identity | ||
| ``` | ||
|
|
||
| * Additionally, to use the async API supported on Python 3.6+, you must first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/): | ||
|
|
||
| ```Bash | ||
| pip install aiohttp | ||
| ``` | ||
|
|
||
| **Create client using the azure-identity library:** | ||
|
|
||
|
|
@@ -43,7 +59,9 @@ schema_registry_client = SchemaRegistryClient(fully_qualified_namespace, credent | |
|
|
||
| ## Key concepts | ||
|
|
||
| - Schema: Schema is the organization or structure for data. | ||
| - Schema: Schema is the organization or structure for data. More detailed information can be found [here][schemas]. | ||
|
|
||
| - Schema Group: A logical group of similar schemas based on business criteria, which can hold multiple versions of a schema. More detailed information can be found [here][schema_groups]. | ||
|
|
||
| - SchemaRegistryClient: `SchemaRegistryClient` provides the API for storing and retrieving schemas in schema registry. | ||
|
|
||
|
|
@@ -67,8 +85,8 @@ from azure.schemaregistry import SchemaRegistryClient | |
|
|
||
| token_credential = DefaultAzureCredential() | ||
| fully_qualified_namespace = os.environ['SCHEMA_REGISTRY_FULLY_QUALIFIED_NAMESPACE'] | ||
| group_name = "<your-group-name>" | ||
| name = "<your-schema-name>" | ||
| group_name = os.environ['SCHEMA_REGISTRY_GROUP'] | ||
| name = "your-schema-name" | ||
| format = "Avro" | ||
| schema_definition = """ | ||
| {"namespace": "example.avro", | ||
|
|
@@ -90,7 +108,7 @@ with schema_registry_client: | |
|
|
||
| ### Get the schema by id | ||
|
|
||
| Get the schema content and its properties by schema id. | ||
| Get the schema definition and its properties by schema id. | ||
|
|
||
| ```python | ||
| import os | ||
|
|
@@ -100,7 +118,7 @@ from azure.schemaregistry import SchemaRegistryClient | |
|
|
||
| token_credential = DefaultAzureCredential() | ||
| fully_qualified_namespace = os.environ['SCHEMA_REGISTRY_FULLY_QUALIFIED_NAMESPACE'] | ||
| id = '<your-schema-id>' | ||
| id = 'your-schema-id' | ||
|
|
||
| schema_registry_client = SchemaRegistryClient(fully_qualified_namespace=fully_qualified_namespace, credential=token_credential) | ||
| with schema_registry_client: | ||
|
|
@@ -110,7 +128,7 @@ with schema_registry_client: | |
|
|
||
| ### Get the id of a schema | ||
|
|
||
| Get the schema id of a schema by schema content and its properties. | ||
| Get the schema id of a schema by schema definition and its properties. | ||
|
|
||
| ```python | ||
| import os | ||
|
|
@@ -120,8 +138,8 @@ from azure.schemaregistry import SchemaRegistryClient | |
|
|
||
| token_credential = DefaultAzureCredential() | ||
| fully_qualified_namespace = os.environ['SCHEMA_REGISTRY_FULLY_QUALIFIED_NAMESPACE'] | ||
| group_name = "<your-group-name>" | ||
| name = "<your-schema-name>" | ||
| group_name = os.environ['SCHEMA_REGISTRY_GROUP'] | ||
| name = "your-schema-name" | ||
| format = "Avro" | ||
| schema_definition = """ | ||
| {"namespace": "example.avro", | ||
|
|
@@ -186,13 +204,6 @@ schema_registry_client.get_schema(id, logging_enable=True) | |
|
|
||
| Please take a look at the [samples][sr_samples] directory for detailed examples of how to use this library to register and retrieve schema to/from Schema Registry. | ||
|
|
||
| ### Event Hubs and Avro Serializer | ||
|
|
||
| We provide [azure-schemaregistry-avroserializer][schemaregistry_avroserializer_pypi] library as serializer | ||
| implementation to serialize/deserialize avro data integrated with `azure-schemaregistry` for automatic schema registration and retrieval. | ||
| It integrates nicely with the [EventHubs SDK][eventhubs_repo]. | ||
| For more information and sample codes, please refer to the [Azure Schema Registry Avro Serializer SDK][schemaregistry_avroserializer_repo]. | ||
|
|
||
| ## Contributing | ||
|
|
||
| This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
|
|
@@ -215,10 +226,12 @@ contact [[email protected]](mailto:[email protected]) with any additio | |
| [azure_sub]: https://azure.microsoft.com/free/ | ||
| [python_logging]: https://docs.python.org/3/library/logging.html | ||
| [sr_samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry/samples | ||
| [api_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-schemaregistry/latest/index.html | ||
| [api_reference]: https://docs.microsoft.com/python/api/overview/azure/schemaregistry-readme | ||
| [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry | ||
| [change_log]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry/CHANGELOG.md | ||
| [schemas]: https://docs.microsoft.com/azure/event-hubs/schema-registry-overview#schemas | ||
| [schema_groups]: https://docs.microsoft.com/azure/event-hubs/schema-registry-overview#schema-groups | ||
| [schemaregistry_service]: https://aka.ms/schemaregistry | ||
| [schemaregistry_avroserializer_repo]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry-avroserializer | ||
| [schemaregistry_avroserializer_pypi]: https://pypi.org/project/azure-schemaregistry-avroserializer/ | ||
| [eventhubs_repo]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/eventhub/azure-eventhub | ||
| [token_credential_interface]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core/azure/core/credentials.py | ||
| [pypi_azure_identity]: https://pypi.org/project/azure-identity/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.