java - What is the best file format to save dynamoDB table? -


because have lot of problems pipeline on amazon have decided use java backup database on file. table 50gb need best way save it. java code read elements , write them file :

public static void fetchitems() {     try{         filewriter file=new filewriter(path);         scanresult result = null;         long sum=0;         do{             scanrequest req = new scanrequest();             req.settablename(datatable);              if(result != null){                 req.setexclusivestartkey(result.getlastevaluatedkey());             }              result = dynamodb.scan(req);             list<map<string, attributevalue>> rows = result.getitems();              for(map<string, attributevalue> map : rows){                 try{                     jsonobject json=new jsonobject(map);                     file.write(json.tostring());                 } catch (numberformatexception e){                     system.out.println(e.getmessage());                 } catch (ioexception e) {                     system.out.println(e.getmessage());                  }             }             sum+= result.getitems().size();             system.out.println("result size: " + sum);          } while(result.getlastevaluatedkey() != null);         file.flush();         file.close();     }catch(ioexception e){         system.out.println(e.getmessage()); 

what extension of file , how can save data? code file big , lot of fields null (problems new jsonobject(map) ), has idea? in file find writen :

{"leaseowner":{"ss":null,"bs":null,"b":null,"s":"ip-120-115-91-22346.eu-west-1.compute.internal:ef5c43f7-f5b7-49cf-99e6-8601db2922e2","n":null,"l":null,"ns":null,"m":null,"null":null,"bool":null},"leasekey":{"ss":null,"bs":null,"b":null,"s":"shardid-000000000002","n":null,"l":null,"ns":null,"m":null,"null":null,"bool":null},"ownerswitchessincecheckpoint":{"ss":null,"bs":null,"b":null,"s":null,"n":"0","l":null,"ns":null,"m":null,"null":null,"bool":null},"checkpoint":{"ss":null,"bs":null,"b":null,"s":"49551567310479336289724454124452290401607015400753594402","n":null,"l":null,"ns":null,"m":null,"null":null,"bool":null},"leasecounter":{"ss":null,"bs":null,"b":null,"s":null,"n":"34905","l":null,"ns":null,"m":null,"null":null,"bool":null}}{"leaseowner":{"ss":null,"bs":null,"b":null,"s":"ip-120-115-91-22346.eu-west-1.compute.internal:ef5c43f7-f5b7-49cf-99e6-8601db2922e2","n":null,"l":null,"ns":null,"m":null,"null":null,"bool":null},"leasekey":{"ss":null,"bs":null,"b":null,"s":"shardid-000000000000","n":null,"l":null,"ns":null,"m":null,"null":null,"bool":null},"ownerswitchessincecheckpoint":{"ss":null,"bs":null,"b":null,"s":null,"n":"0","l":null,"ns":null,"m":null,"null":null,"bool":null},"checkpoint":{"ss":null,"bs":null,"b":null,"s":"49551567310434734799327392878132951190473279252744634370","n":null,"l":null,"ns":null,"m":null,"null":null,"bool":null},"leasecounter":{"ss":null,"bs":null,"b":null,"s":null,"n":"34913","l":null,"ns":null,"m":null,"null":null,"bool":null}}{"leaseowner":{"ss":null,"bs":null,"b":null,"s":"ip-120-115-91-22346.eu-west-1.compute.internal:ef5c43f7-f5b7-49cf-99e6-8601db2922e2","n":null,"l":null,"ns":null,"m":null,"null":null,"bool":null},"leasekey":{"ss":null,"bs":null,"b":null,"s":"shardid-000000000001","n":null,"l":null,"ns":null,"m":null,"null":null,"bool":null},"ownerswitchessincecheckpoint":{"ss":null,"bs":null,"b":null,"s":null,"n":"0","l":null,"ns":null,"m":null,"null":null,"bool":null},"checkpoint":{"ss":null,"bs":null,"b":null,"s":"49551567310457035544525923501292620796040147120590684178","n":null,"l":null,"ns":null,"m":null,"null":null,"bool":null},"leasecounter":{"ss":null,"bs":null,"b":null,"s":null,"n":"34912","l":null,"ns":null,"m":null,"null":null,"bool":null}}

after have implement restore application.

i did csv format seems concise. first line should contain field names (sort of excel title) not repeated every line , stil enable parsing file. null values adjacent commas.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -