Recommand · October 22, 2021 0

How to create the list inside the dictionary using python

I am trying to Automate the dataset creation in quicksight using Boto3.
but I am stuck some point . please any one help to solve this.
Here my code :

qs = boto3.client('quicksight')

response = qs.describe_data_set(
    AwsAccountId='xxxxxxxx',
    DataSetId='testdatasetv4'
)

columns =response['DataSet']['PhysicalTableMap']['string']['RelationalTable']['InputColumns']

for dic in columns:
    for key in dic:
        print({dic[key]})

I need a output like this:

response1 = Client.create_data_set(
    AwsAccountId=data['AwsAccountId1'],
    DataSetId=data['DatasetId'],
    Name='testdataset',
    PhysicalTableMap={
        'string': {
            'RelationalTable': {
                'DataSourceArn':response['Arn'],
                'Schema': 'public',
                'Name': 'sales',
             
            
                'InputColumns': [
                    {
                        'Name': 'salesid',
                        'Type': 'INTEGER'
                    },
                    {
                        'Name': 'listid',
                        'Type': 'INTEGER'
                    },
                     {
                        'Name': 'sellerid',
                        'Type': 'INTEGER'
                    },
                     {
                        'Name': 'buyerid',
                        'Type': 'INTEGER'
                    },
                     {
                        'Name': 'eventid',
                        'Type': 'INTEGER'
                    },
                    {
                        'Name': 'dateid',
                        'Type': 'INTEGER'
                    },
                    {
                        'Name': 'qtysold',
                        'Type': 'INTEGER'
                    },
                    {
                        'Name': 'pricepaid',
                        'Type': 'DECIMAL'
                    },
                      
                    {
                        'Name': 'commission',
                        'Type': 'DECIMAL'
                    },     
                    
                    {
                        'Name': 'saletime',
                        'Type': 'DATETIME'
                    },
                ]
            }
        }
    },

How can I add the above Input columns through a code. I am able extract the input columns but I didn’t any idea to add input columns . please help me to do this.