[BEAM-5624] Fix avro.schema parser for py3#6616
Conversation
| import hamcrest as hc | ||
| # pylint: disable=wrong-import-order, wrong-import-position, ungrouped-imports | ||
| try: | ||
| from avro.schema import Parse |
There was a problem hiding this comment.
Could you add a comment here about, in what versions of avro which version of parse is supported. (We can use this information to remove this block later on.)
There was a problem hiding this comment.
+1 to @aaltay's comment. Also we will need a similar change in other places in Beam where we use avro.schema.parse. See apache_beam/io/avroio.py, apache_beam/examples/avro_bitcoin.py. This can be done in another PR if you prefer.
There was a problem hiding this comment.
also apache_beam/examples/fastavro_it_test.py.
There was a problem hiding this comment.
Thank you both for the feedback.
@aaltay I have added a comment stating that python2 uses the 'avro' library, whereas python3 uses 'avro-python3'.
@tvalentyn I have made the changes in the related files as well.
Note that although I had disabled pylint wrong-import-order and wrong-import-position, it still did not pass the precommit check so I had to reposition the imports to continue, PTAL, thanks!
34225ec to
e2c25d5
Compare
Fix for the following error mentioned in BEAM-5624:
AttributeError (module 'avro.schema' has no attribute 'parse')
This is is part of a series of PRs with goal to make Apache Beam PY3 compatible. The proposal with the outlined approach has been documented here.
@tvalentyn @Fematich @charlesccychen @aaltay @Juta @manuzhang
Post-Commit Tests Status (on master branch)