Skip to content
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

[Schema Registry] Fix docstring and docs #13625

Merged
merged 7 commits into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
# PRLabel: %Recovery Services
/sdk/recoveryservices/ @DheerendraRathor

# PRLabel: %Schema Registry
/sdk/schemaregistry/ @yunhaoling

# PRLabel: %Search
/sdk/search/ @xiangyan99 @rakshith91

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 1.0.0b1 (2020-09-08)
## 1.0.0b1 (2020-09-09)

Version 1.0.0b1 is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Schema Registry Avro Serializer.

Expand Down
42 changes: 36 additions & 6 deletions sdk/schemaregistry/azure-schemaregistry-avroserializer/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Azure Schema Registry Avro Serializer client library for Python

Azure Schema Registry Avro Serializer provides the ability to serialize and deserialize data according
to the given avro schema. It is integrated with Azure Schema Registry SDK and will automatically register and get schema.
Azure Schema Registry is a schema repository service hosted by Azure Event Hubs, providing schema storage, versioning,
and management. This package provides an Avro serializer capable of serializing and deserializing payloads containing
Schema Registry schema identifiers and Avro-encoded data.

[Source code][source_code] | [Package (PyPi)][pypi] | [API reference documentation][api_docs] | [Samples][sr_avro_samples] | [Changelog][change_log]
[Source code][source_code] | [Package (PyPi)][pypi] | [API reference documentation][api_reference] | [Samples][sr_avro_samples] | [Changelog][change_log]

## Getting started

Expand All @@ -18,7 +19,7 @@ pip install azure-schemaregistry-avroserializer azure-identity
### Prerequisites:
To use this package, you must have:
* Azure subscription - [Create a free account][azure_sub]
* Azure Schema Registry
* [Azure Schema Registry][schemaregistry_service]
* Python 2.7, 3.5 or later - [Install Python][python]

### Authenticate the client
Expand All @@ -40,7 +41,34 @@ serializer = SchemaRegistryAvroSerializer(schema_registry_client, schema_group)

## Key concepts

- Avro: Apache Avro™ is a data serialization system.
### SchemaRegistryAvroSerializer

Provides API to serialize to and deserialize from Avro Binary Encoding plus a
header with schema ID. Uses [SchemaRegistryClient][schemaregistry_client] to get schema IDs from schema content or vice versa.

### Message format

The same format is used by schema registry serializers across Azure SDK languages.

Messages are encoded as follows:

- 4 bytes: Format Indicator

- Currently always zero to indicate format below.

- 32 bytes: Schema ID

- UTF-8 hexadecimal representation of GUID.
- 32 hex digits, no hyphens.
- Same format and byte order as string from Schema Registry service.

- Remaining bytes: Avro payload (in general, format-specific payload)

- Avro Binary Encoding
- NOT Avro Object Container File, which includes the schema and defeats the
purpose of this serialzer to move the schema out of the message payload and
into the schema registry.


## Examples

Expand Down Expand Up @@ -171,4 +199,6 @@ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additio
[sr_avro_samples]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/schemaregistry/azure-schemaregistry-avroserializer/samples
[api_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-schemaregistry-avroserializer/latest/index.html
[source_code]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/schemaregistry/azure-schemaregistry-avroserializer
[change_log]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/schemaregistry/azure-schemaregistry-avroserializer/CHANGELOG.md
[change_log]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/schemaregistry/azure-schemaregistry-avroserializer/CHANGELOG.md
[schemaregistry_client]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/schemaregistry/azure-schemaregistry
[schemaregistry_service]: https://aka.ms/schemaregistry
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
# IN THE SOFTWARE.
#
# --------------------------------------------------------------------------
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
# IN THE SOFTWARE.
#
# --------------------------------------------------------------------------
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
2 changes: 1 addition & 1 deletion sdk/schemaregistry/azure-schemaregistry/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 1.0.0b1 (2020-09-08)
## 1.0.0b1 (2020-09-09)

Version 1.0.0b1 is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Schema Registry.

Expand Down
12 changes: 8 additions & 4 deletions sdk/schemaregistry/azure-schemaregistry/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Azure Schema Registry client library for Python

Azure Schema Registry is a service that provides the ability to store and retrieve different types of schemas such as
Avro, Json, etc.
Azure Schema Registry is a schema repository service hosted by Azure Event Hubs, providing schema storage, versioning,
and management. The registry is leveraged by serializers to reduce payload size while describing payload structure with
schema identifiers rather than full schemas.

[Source code][source_code] | [Package (PyPi)][pypi] | [API reference documentation][api_reference] | [Samples][sr_samples] | [Changelog][change_log]

Expand All @@ -18,7 +19,7 @@ pip install azure-schemaregistry azure-identity
### Prerequisites:
To use this package, you must have:
* Azure subscription - [Create a free account][azure_sub]
* Azure Schema Registry
* [Azure Schema Registry][schemaregistry_service]
* Python 2.7, 3.5 or later - [Install Python][python]

### Authenticate the client
Expand All @@ -39,6 +40,8 @@ schema_registry_client = SchemaRegistryClient(endpoint, credential)

- Schema: Schema is the organization or structure for data.

- SchemaRegistryClient: `SchemaRegistryClient ` provides the API for storing and retrieving schemas in schema registry.

## Examples

The following sections provide several code snippets covering some of the most common Schema Registry tasks, including:
Expand Down Expand Up @@ -196,4 +199,5 @@ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additio
[sr_samples]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/schemaregistry/azure-schemaregistry/samples
[api_reference]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-schemaregistry/latest/index.html
[source_code]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/schemaregistry/azure-schemaregistry
[change_log]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/schemaregistry/azure-schemaregistry/CHANGELOG.md
[change_log]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/schemaregistry/azure-schemaregistry/CHANGELOG.md
[schemaregistry_service]: https://aka.ms/schemaregistry
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
# IN THE SOFTWARE.
#
# --------------------------------------------------------------------------
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore

from ._version import VERSION
__version__ = VERSION

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class SchemaProperties(object):
:end-before: [END print_schema_properties]
:language: python
:dedent: 4
:caption: SchemaId object.
:caption: SchemaProperties object.

"""
def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def register_schema(

.. admonition:: Example:

.. literalinclude:: ../samples/async_samples/sample_code_schemaregistry.py
.. literalinclude:: ../samples/async_samples/sample_code_schemaregistry_async.py
:start-after: [START register_schema_async]
:end-before: [END register_schema_async]
:language: python
Expand Down Expand Up @@ -133,7 +133,7 @@ async def get_schema(

.. admonition:: Example:

.. literalinclude:: ../samples/async_samples/sample_code_schemaregistry.py
.. literalinclude:: ../samples/async_samples/sample_code_schemaregistry_async.py
:start-after: [START get_schema_async]
:end-before: [END get_schema_async]
:language: python
Expand Down Expand Up @@ -173,7 +173,7 @@ async def get_schema_id(
:end-before: [END get_schema_id_async]
:language: python
:dedent: 4
:caption:Get schema id.
:caption: Get schema by id.

"""
try:
Expand Down
2 changes: 2 additions & 0 deletions sdk/schemaregistry/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ extends:
Artifacts:
- name: azure_schemaregistry
safeName: azureschemaregistry
- name: azure_schemaregistry_avroserializer
safeName: azureschemaregistryavroserializer