[
https://issues.apache.org/jira/browse/AVRO-659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907286#action_12907286
]
Philip Zeyliger commented on AVRO-659:
--------------------------------------
Because AVRO is not a programming language? AVRO's metadata (the schema) is a
single string. It has no external references. The "compiler" layer (in this
case, AvroIDL) takes care of external references (via include) and creates a
string. Avro will help you embed that string in an avro data file, and it will
help you embed that string in generated code (org.foo.bar.MyRecord.SCHEMA$), or
you can store that string however you'd like and get at it.
It may be that we're talking past each other. I'm guessing that your
motivation is that it's tricky to write:
{noformat}
schema = schema.parse(file(os.path.join(os.path.dirname(__path__),
"myschema.avsc")))
{noformat}
In Java, one would write that roughly as
Schema.parse(this.getClass().getResourceAsStream("myschema.avsc")). (I don't
recall whether Schema.parse will take a stream, but it certainly could.)
What would be better?
schema.parse_from_avro_specific_logic_for_importing_files("myschema.avsc")
would be more confusing. Generating a file that contains the schema (i.e.,
"from mygeneratedcode.schema import SCHEMA_STRING;
schema.parse(SCHEMA_STRING)") would be reasonable (and is my suggestion above).
> Portable specification of the location of schema and protocol files
> -------------------------------------------------------------------
>
> Key: AVRO-659
> URL: https://issues.apache.org/jira/browse/AVRO-659
> Project: Avro
> Issue Type: New Feature
> Reporter: Jeff Hammerbacher
>
> Avro doesn't require code generation, which is great. However, if you want to
> use a protocol or a schema, your code needs to know where to find it. When
> your code is ported to new systems, the protocol or schema file must be
> placed in the same place as on the previous system for things to work
> correctly.
> For importing modules in a portable fashion, Python provides a default set of
> places it will look for modules and an environment variable called PYTHONPATH
> that programs can use to override these defaults. It may be useful to explore
> similar constructs for Avro implementations that don't do code generation.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.