Kailash Panwar
Kailash Panwar

Reputation: 91

Saving data in a for loop in dynamoDB AWS

I have to save data in 6 tables in dynamoDB AWS, can I put a 'for' loop and save one by one as shown below :-

DynamoDBMapper mapper = new DynamoDBMapper(dynamoDB);
for(i=0;i<6;i++)
{
mapper.save(<TABLE 1 DATA>)
// and loop and save data in every table
}

Does it looks fine or it can create some problem as I am doing data base operation in loop? My tables are very small(5 columns)

Thanks Kailash

Upvotes: 0

Views: 612

Answers (2)

Aliaksandr Kazlou
Aliaksandr Kazlou

Reputation: 3301

If you only need to download the data from the table into a local file, like CSV, for example, you can use this CLI tool https://github.com/zshamrock/dynocsv to export data from your table into the CSV file.

Upvotes: 0

GAK
GAK

Reputation: 1088

Running in the for loop is a bad idea and you can use the batch write item api. dynamoDB.batchWriteItem(TableWriteItems... yourMultipleTableWriteItems)

Upvotes: 1

Related Questions