title: updating a nested dictionary using two other dictionaries
body: <p>I have an nested dictionary which I am looking to update using two dictionaries. The empty dictionary which I am looking to populate is as below:-</p>
  
  <pre><code>master_config_skeleton = {
  "ingestion_config":
      {
      "location":{}, 
      "start_sequence":{}, 
      "datafeed":
          {
          "t04047":
              {
              "validation":
                  {
                  "triple_check":{},
                  "record_count_validation":{}
                  }, 
              "date_pattern":{}, 
              "cdc_config": {}
              }
          }
      }
  }
  </code></pre>
  
  <p>One of dictionaries which holds the path of traversal looks like this.</p>
  
  <pre><code>    traversal_path_dict = {
          'cdc_config': "['ingestion_config']['datafeed']['t04047']['cdc_config']",
          'datafeed': "['ingestion_config']['datafeed']",
          'date_pattern': "['ingestion_config']['datafeed']['t04047']['date_pattern']",
          'ingestion_config': "['ingestion_config']",
          'location': "['ingestion_config']['location']",
          'record_count_validation': "['ingestion_config']['datafeed']['t04047']['validation']['record_count_validation']",
          'start_sequence': "['ingestion_config']['start_sequence']",
          't04047': "['ingestion_config']['datafeed']['t04047']",
          'triple_check': "['ingestion_config']['datafeed']['t04047']['validation']['triple_check']",
          'validation': "['ingestion_config']['datafeed']['t04047']['validation']"}
  </code></pre>
  
  <p>And the other dictionary which actually holds the data looks as below:-</p>
  
  <pre><code>master_data_dict = {   'cdc_config': {   'active_table': 'db_b2b_curated_flexcab_active.t04047',
                        'custom_cdc_query': '',
                        'delete_filters': '["","",""]',
                        'delete_query': '',
                        'history_table': 'db_b2b_curated_flexcab_historical.t04047_historical',
                        'key_cols': '[INVC_ARGT_ID, BILL_CYCLE_EFF_DT, '
                                    'BILL_CYCLE_CD]',
                        'start_date_col': '[BILL_CYCLE_EFF_DT]',
                        'update_ts_col': 'bill_cycle_end_dt'},
      'date_pattern': {'ord_end_dt': '%d.%m.%Y', 'ord_sta_dt': '%d.%m.%Y'},
      'ingestion_config': {   'app': 'Replicator',
                              'feed_id': 2382,
                              'hdfs_home_dir': '/data/b2b',
                              'seq_type': 'SEQUENCE',
                              'source': 'FLEXCAB'},
      'location': {   'base_dir': '/home/sfxuser/B2B_DATALAKE/data/b2b/land/FLEXCAB',
                      'error_dir': 'Error',
                      'input_dir': 'Input',
                      'unzipped_dir': 'src'},
      'record_count_validation': {   'footer': 'N',
                                     'header': 'N',
                                     'rec_cnt_pos_ctl': '0:10'},
      'start_sequence': {'initial_seq_id': '00000001', 'length': 8},
      't04047': {   'cdc': 'N',
                    'config_path': '/apps/b2b_datalake/legacy/FLEXCAB/cfg/CSV/t04047.csv',
                    'format': 'fixedwidth'},
      'triple_check': {   'file_count': 3,
                          'file_extensions': '[zip, ctl, eot]',
                          'file_pattern': 'FLEXCAB_B2B_T04047_O_(&lt;batch_seq&gt;)_*'},
      'validation': {'file_date_format': '%Y%m%d%H%M%S'}}
  </code></pre>
  
  <p>As you can notice, not all the keys in the dictionary which I am looking to populate have values. The 2nd dictionary is basically a pandas data frame generated from an excel which holds key value pairs. All the sheets of the excel workbook are stored in a separate list:-</p>
  
  <pre><code>sheets = ['ingestion_config', 'location', 'start_sequence', 'datafeed', 't04047', 'validation', 'triple_check', 'record_count_validation', 'date_pattern', 'cdc_config']
  </code></pre>
  
  <p>What I've tried so far:-</p>
  
  <pre><code>for sheet in sheets:
      master_config_skeleton[traversal_path_dict[sheet]].update(master_data_dict[sheet])
  </code></pre>
  
  <p>but because of the square brackets qualifying the values, I am getting a key error.</p>