dhorions / DynamodbToCSV4j

Dump DynamoDB data into a CSV file using java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

d2csv not working

ravi207 opened this issue · comments

hi the java code d2csv is not working to be particular there is an error in the dynamodb object declaration
DynamoDB dynamoDB = new DynamoDB(client);
error:- DynamoDB cannot be resolved to a type

note:- I have imported all the required jar files

@ravi207 you need to make a change in import statement of DynamodbToCSV4j.java as follows:

import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

and in d2csv.java as follows:

import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient;
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
import com.amazonaws.services.dynamodbv2.model.ScanRequest;
import com.amazonaws.services.dynamodbv2.model.ScanResult;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

//import com.amazonaws.util.json.JSONArray;
//import com.amazonaws.util.json.JSONException;
//import com.amazonaws.util.json.JSONObject;

import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;

and need to add following jar files:

aws-java-sdk-1.11.156
commons-csv-1.1
commons-logging-1.2
httpclient-4.5.6
httpcore-4.4.10
jackson-annotations-2.9.7
jackson-core-2.9.7
jackson-databind-2.9.7
java-json
joda-time-2.8.1