From 265f4106f499ec5d2d01a127ba192404c1836a28 Mon Sep 17 00:00:00 2001 From: Kamal Aboul-Hosn Date: Fri, 15 Dec 2023 12:41:38 -0500 Subject: [PATCH] fix: Swap writer and reader schema to correct places in sample (#1052) * samples: schema evolution * Add command-line commands * Fix tag for rollback * Make formatting fixes * Formatting fixes * Fix exceptions * fix: Set x-goog-request-params for streaming pull request * Set blunderbuss config to auto-assign issues and PRs * fix: Swap writer and reader schema to correct places in sample --- samples/snippets/schema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/snippets/schema.py b/samples/snippets/schema.py index 3260a0e19..b492ccf33 100644 --- a/samples/snippets/schema.py +++ b/samples/snippets/schema.py @@ -645,7 +645,7 @@ def subscribe_with_avro_schema_with_revisions( subscription_path = subscriber.subscription_path(project_id, subscription_id) with open(avsc_file, "rb") as file: - writer_avro_schema = schema.parse(file.read()) + reader_avro_schema = schema.parse(file.read()) # Dict to keep readers for different schema revisions. revisions_to_readers = {} @@ -665,7 +665,7 @@ def callback(message: pubsub_v1.subscriber.message.Message) -> None: print(f"{schema_path} not found.") message.nack() return - reader_avro_schema = schema.parse(received_avro_schema.definition) + writer_avro_schema = schema.parse(received_avro_schema.definition) revisions_to_readers[schema_revision_id] = DatumReader( writer_avro_schema, reader_avro_schema )