You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Marcio Silva (Updated) (JIRA)" <ji...@apache.org> on 2012/02/04 06:35:53 UTC
[jira] [Updated] (AVRO-301) Handle non-reserved properties
appropriately in the Python implementation
[ https://issues.apache.org/jira/browse/AVRO-301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcio Silva updated AVRO-301:
------------------------------
Attachment: AVRO-301-patch-1.patch
This patch adds support for non-reserved properties to the Schemas that support them.
It currently depends on my patch to AVRO-300, but that could be removed if necessary.
It adds an "other_props" property to *Schema* and *Field* which exposes a dictionary of all the unreserved properties.
Given *example_schema* below:
{code:JavaScript|title:example_schema}
{ "name":"foo",
"type":"record",
"custom_prop":[1,2,3]
"fields":[
{"name":"field1",
"type":"int",
"tag":"value"}
]
}
{code}
{code:title=API Usage}
>>> from avro import schema
>>> s = schema.parse(example_schema)
>>> s.other_props
{u'custom_prop': [1, 2, 3]}
>>> [f.name for f in s.fields if f.get_prop('tag')]
[u'field1']
{code}
> Handle non-reserved properties appropriately in the Python implementation
> -------------------------------------------------------------------------
>
> Key: AVRO-301
> URL: https://issues.apache.org/jira/browse/AVRO-301
> Project: Avro
> Issue Type: New Feature
> Components: python
> Reporter: Jeff Hammerbacher
> Assignee: Jeff Hammerbacher
> Attachments: AVRO-301-patch-1.patch
>
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira