title: How can i append new data to sql (with python 2.7)
body: <p>I wrote this code : </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>df = pd.DataFrame(maindatatable)
  now = datetime.date.today()
  df['date'] = now
  #df.rows = header
  df.to_csv('output.csv', sep=';', encoding='latin-1', index=True)
  
  connection = MySQLdb.connect(host='localhost',
      user='root',
      passwd='1234',
      db='database')
  cursor = connection.cursor()
  query = """ load data local infile 'C:/Python27/output.csv' 
  into table valami
  character set latin1
  fields terminated by ';'
  lines terminated by '\n'
  ignore 1 lines;
  """
  cursor.execute(query)
  connection.commit()
  cursor.close()</code></pre>
  </div>
  </div>
  </p>
  
  <p>I used web-scraping a table from the internet every day, and i want to import to the sql. How can i do that, if i run my code every day, the values put into this sql table ? (append?)</p>
  
  <p>output.csv code : </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>filename=r'output.csv'
  
  resultcsv=open(filename,"wb")
  output=csv.writer(resultcsv, delimiter=';',quotechar = '"', quoting=csv.QUOTE_NONNUMERIC, encoding='latin-1')
  header = ['Pénznem', 'Devizanév','Egység','Pénznem_Forintban', 'date']
  output.writerow(header)
  
  def make_soup(url):
      thepage = urllib2.urlopen(url)
      soupdata = BeautifulSoup(thepage, "html.parser")
      return soupdata
  
  def to_2d(l,n):
      return [l[i:i+n] for i in range(0, len(l), n)]
  
  soup=make_soup("https://www.mnb.hu/arfolyamok")
  
  datatable=[]
  for record in soup.findAll('tr'):
      for data in record.findAll('td'):
          datatable.append(data.text)
  maindatatable = to_2d(datatable, 4)
  
  output.writerows(maindatatable)
  
  resultcsv.close()</code></pre>
  </div>
  </div>
  </p>