Skip to content

Commit 265f410

Browse files
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
1 parent 062c132 commit 265f410

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

samples/snippets/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ def subscribe_with_avro_schema_with_revisions(
645645
subscription_path = subscriber.subscription_path(project_id, subscription_id)
646646

647647
with open(avsc_file, "rb") as file:
648-
writer_avro_schema = schema.parse(file.read())
648+
reader_avro_schema = schema.parse(file.read())
649649
# Dict to keep readers for different schema revisions.
650650
revisions_to_readers = {}
651651

@@ -665,7 +665,7 @@ def callback(message: pubsub_v1.subscriber.message.Message) -> None:
665665
print(f"{schema_path} not found.")
666666
message.nack()
667667
return
668-
reader_avro_schema = schema.parse(received_avro_schema.definition)
668+
writer_avro_schema = schema.parse(received_avro_schema.definition)
669669
revisions_to_readers[schema_revision_id] = DatumReader(
670670
writer_avro_schema, reader_avro_schema
671671
)

0 commit comments

Comments
 (0)