title: How to insert multiple rows of a pandas dataframe into Azure Synapse SQL DW using pyodbc?
body: <p>I am using pyodbc to establish connection with Azure Synapse SQL DW. The connection is successfully established. However when it comes to inserting a pandas dataframe into the database, I am getting an error when I try inserting multiple rows as values.  However, it works if I insert rows one by one. Inserting multiple rows together as values used to work fine with AWS Redshift and MS SQL, but fails with Azure Synapse SQL DW. I think the Azure Synapse SQL is T-SQL and not MS-SQL. Nonetheless, I am unable to find any relevant documentation as well.</p>
  
  <p>I have a pandas df named 'df' that looks like this:</p>
  
  <pre><code>student_id  admission_date
      1          2019-12-12
      2          2018-12-08
      3          2018-06-30
      4          2017-05-30
      5          2020-03-11
  </code></pre>
  
  <p>This code below works fine</p>
  
  <pre><code>import pandas as pd
  import pyodbc
  #conn object below is the pyodbc 'connect' object
  
      batch_size = 1
      i = 0
      chunk = df[i:i+batch_size]
      conn.autocommit = True
      sql = 'insert INTO {} values {}'.format('myTable', ','.join(
          str(e) for e in zip(chunk.student_id.values, chunk.admission_date.values.astype(str))))
      print(sql)
      cursor = conn.cursor()
      cursor.execute(sql)
  </code></pre>
  
  <p>As you can see, it's inserting just 1 row of the 'df'. So, yes, I  can loop through and insert one by one but it takes hell lot of time when it comes dataframes of larger sizes</p>
  
  <p>This code below doesn't work when I try to insert all rows together
      import pandas as pd
      import pyodbc</p>
  
  <pre><code>batch_size = 5
  i = 0
  chunk = df[i:i+batch_size]
  conn.autocommit = True
  sql = 'insert INTO {} values {}'.format('myTable', ','.join(
          str(e) for e in zip(chunk.student_id.values, chunk.admission_date.values.astype(str))))
  print(sql)
  cursor = conn.cursor()
  cursor.execute(sql)
  </code></pre>
  
  <p>The error I  get this one below:</p>
  
  <blockquote>
    <p>ProgrammingError: ('42000', "[42000]
    [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Parse error at
    line: 1, column: 74: Incorrect syntax near ','. (103010)
    (SQLExecDirectW)")</p>
  </blockquote>
  
  <p>This is the sample SQL query for 2 rows which fails:</p>
  
  <pre><code>insert INTO myTable values (1, '2009-12-12'),(2, '2018-12-12')
  </code></pre>