code: def dict_row_strategy(column_names):
      
      # replace empty column names with indices
      column_names = [(name or idx) for idx, name in enumerate(column_names)]
  
      def row_factory(row):
          return dict(zip(column_names, row))
  
      return row_factory
docs: Dict row strategy, rows returned as dictionaries