Trouble programatically duplicating datasets

Is there an easy way to duplicate a DataSet? I’ve tried the following code but running into the following error:


    private DataSet copyDataSet(DataSet source, String name){
        CreateDataSetRequest request = CreateDataSetRequest.builder()
//                .permissions()
//                .tags()
        CreateDataSetResponse response = client.createDataSet(request);
        return describeDataSet(response.dataSetId());


Unable to process your request while preparing the table view from your schema, calculated columns [Days Until Lost] are invalid. ErrorType: CONTEXTUAL_UNKNOWN_SYMBOL (Service: QuickSight, Status Code: 400, Request ID: 6a1942f7-4d3b-4a56-b5dd-55073ed518a9)

I found this (What could cause CONTEXTUAL_UNKNOWN_SYMBOL error?) and its possible there is an issue with ordering of calculation fields (suspect they are depending on other fields not yet loaded)

Can someone give me some advice on how I can duplicate my DataSet?

Update: Leveraged JGraphT determine the TopologicalOrder of calculated fields based on the references it has … but now I get another error:

ErrorType: CONTEXTUAL_INVALID_ARGUMENT_TYPE (Service: QuickSight, Status Code: 400, Request ID: eee838bd-defe-4e84-bd02-8406173a1b6c)

In describe dataset I believe you need to pass in the AWS account Id as well.

Unless that describeDataSet is a function you created yourself which it looks like it is.

Yeah, the describe dataset was something I created. It does pass the awsAccountId … but the application blows up on the line before that @

CreateDataSetResponse response = client.createDataSet(request)

What language are you using?

@ccaspanello, I am using Java