Deserialize django json data dump one record at the time? -
i`m trying read file json-data, use loads(data) simplejson method , extract create dictionary representing values each column in record, instead of using "standard" or documented way of :
for obj in serializers.deserialize("json", data): # obj
because want avoid creating django orm objects each record, want dictionary representing each object can insert database using plain sql gain speed. problem loads(data) needs read data memory , want avoid keep memory usage low , read entry entry in json-data. possible iterator yields data 1 record? , secondly, can skip entire creation of django orm objects when deserializing json data , dictionary of values?
input , thoughts welcome.
thanks time.
if don't want create orm objects, there's no point in using django deserialization methods. load json using underlying simplejson
library:
from django.utils import simplejson my_data = simplejson.loads(data)
Comments
Post a Comment