title: Writing Generic cursor.executemany() in python
body: <p>Im new to python, trying to write a generic function that has arguments as the list of dictionaries, tablename, dbusername, password and Insert different data in to different tables like below</p>
  <p>dict_list=[{'name': 'sandeep', 'age': '10'}, {'name': 'sa', 'age': '0'}]
  another_dict_list=[{'area': 'AP', 'pin': '00'}, {'area': 'UP', 'pin': '01'}]</p>
  <pre><code>def func(listofdict, tablename, dbusername, dbpassword):
    #all connection and cursor code  here#
    query = &quot;&quot;&quot;insert into tablename (dict keys) values(dict values)&quot;&quot;&quot;
    cursor.executemany(query, listofdict)
  
  </code></pre>
  <p>now ill call the above funtion</p>
  <pre><code>func(dict_list, nametable, dbuser, dbpassword)
  func(another_dict_list ,areatable, dbuser, dbpassword)
  
  </code></pre>
  <p>Wanted to know if we can write a generic code for insertion of data using execute many</p>