Quicksight: join datasets using api

0

Hello, I'm looking at options to programmatically create datasets by joining existing datasets. Is that possible?

posta un anno fa348 visualizzazioni
1 Risposta
0

Hi.

yes you can You create a new dataset with the CreateDataSet API. The creation parameter LogicalTableMap allows you to combine and JOIN existing datasets Arn.

An example would be:

{
    "AwsAccountId": "123456789012",
    "DataSetId": "hoge0425dataset1111111",
    "Name": "hoge0425dataset1111111",
    "PhysicalTableMap": {},
    "LogicalTableMap": {
        "hoge0425b": {
            "Alias": "hoge0425b",
            "DataTransforms": [
                {
                    "RenameColumnOperation": {
                        "ColumnName": "key1",
                        "NewColumnName": "key1[hoge0425b]"
                    }
                }
            ],
            "Source": {
                "DataSetArn": "arn:aws:quicksight:ap-northeast-1:123456789012:dataset/599be6e0-c054-4d56-91cb-eb3b3a24a25d"
            }
        },
        "hoge0425a": {
            "Alias": "hoge0425a",
            "Source": {
                "DataSetArn": "arn:aws:quicksight:ap-northeast-1:123456789012:dataset/a1e4803a-5ea6-4191-ac14-7bf4a434e695"
            }
        },
        "hoge0425c": {
            "Alias": "Intermediate Table",
            "DataTransforms": [
                {
                    "ProjectOperation": {
                        "ProjectedColumns": [
                            "key1",
                            "val1",
                            "key1[hoge0425b]",
                            "val2"
                        ]
                    }
                }
            ],
            "Source": {
                "JoinInstruction": {
                    "LeftOperand": "hoge0425a",
                    "RightOperand": "hoge0425b",
                    "Type": "LEFT",
                    "OnClause": "key1 = {key1[hoge0425b]}"
                }
            }
        }
    },
    "ImportMode": "SPICE",
    "FieldFolders": {},
    "Permissions": [
        {
            "Principal": "arn:aws:quicksight:ap-northeast-1:123456789012:user/default/hoge-iwasa.takahito/hoge-iwasa.takahito",
            "Actions": [
                "quicksight:PassDataSet",
                "quicksight:CreateIngestion",
                "quicksight:DeleteRefreshSchedule",
                "quicksight:UpdateRefreshSchedule",
                "quicksight:UpdateDataSet",
                "quicksight:DeleteDataSetRefreshProperties",
                "quicksight:CreateRefreshSchedule",
                "quicksight:DescribeDataSetPermissions",
                "quicksight:ListIngestions",
                "quicksight:UpdateDataSetPermissions",
                "quicksight:DescribeIngestion",
                "quicksight:PutDataSetRefreshProperties",
                "quicksight:DeleteDataSet",
                "quicksight:DescribeDataSet",
                "quicksight:CancelIngestion",
                "quicksight:DescribeRefreshSchedule",
                "quicksight:ListRefreshSchedules",
                "quicksight:DescribeDataSetRefreshProperties"
            ]
        }
    ],
    "DataSetUsageConfiguration": {
        "DisableUseAsDirectQuerySource": false,
        "DisableUseAsImportedSource": false
    }
}

Here, hoge0425a and hoge0425b are existing datasets. hoge0425c is the new combined dataset.

You can also try creating a combined dataset from the console and see how the LogicalTableMap is constructed with the DesribeDataSet API.

profile picture
ESPERTO
iwasa
con risposta un anno fa
  • Thanks. So if I plan on calling CreateDataSet API and pass the above LogicalTableMap value as one of the parameters, what should the PhysicalTableMap be. I noticed its blank here, but is a mandatory parameter when calling CreateDataSet.

  • "{}" is fine because it is just joining from an existing dataset. you will succeed with it.

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande