avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marius <m_die...@uni-muenster.de>
Subject Silent error while writing file, Python
Date Fri, 10 Apr 2015 12:21:22 GMT
Hello,

i want to store data from an XML file in avro. In order to test my 
scheme, i wanted to write a small amount of data to it. The program 
finished without an error, however the file is empty so no data was 
appended.

===avro_test.py===

importavro.schema
fromavro.datafileimportDataFileReader, DataFileWriter
fromavro.ioimportDatumReader, DatumWriter

schema = avro.schema.Parse(open("user.avsc").read())


test1 = {"id":5}
test = {"count":3,"cvList": test1}



writer = DataFileWriter(open("users.avro","wb"), DatumWriter(), schema)
writer.append({"count":5,"cvList": {"id":5}})
writer.close


===user.avsc===
{
   "name":"cv",
   "type":"record",
   "fields": [
     {"name":"count","type":"int"},
     {"name":"cvList",
       "type": {
         "name":"cvData",
         "type":"record",
         "fields": [
           {"name":"id","type":"int"}
         ]
       }
     }
   ]
}

==end==

I'm sorry if something obvious is wrong, i'm new to avro and json. 
What's bothering me is that there was no error while executing.

Grüße

Marius


Mime
View raw message