title: Better way to import data from REST API to SQL DB using Python?
body: <p>I've written some python code to extract data from a rest api and load them in an Azure SQL database. But this process is taking almost half a hour for 20,000 lines. Is there a more efficient way of doing this? I'm thinking maybe extract the data as json file and put it in blob storate then use azure data factory to load the data into SQL, but have no idea how to code this way. </p>
  
  <pre><code>def manualJournalLineItems(tenantid):
  endpoint = "api.xro/2.0/manualjournals/?page=1"
  
  result = (getAPI(endpoint,token,tenantid))
  page = 1
  while result['ManualJournals']:
      endpoint = "api.xro/2.0/manualjournals/?page="+str(page)
      result = (getAPI(endpoint,token,tenantid))
      for inv in result['ManualJournals']:
          for li in inv['JournalLines']:
              cursor.execute("INSERT INTO [server].dbo.[Xero_ManualJournalLines](ManualJournalID,AccountID,Description,LineAmount,TaxAmount,AccountCode,Region) VALUES(?,?,?,?,?,?,?)",inv['ManualJournalID'],li['AccountID'],li.get('Description',''),li.get('LineAmount',0),li.get('TaxAmount',0),li.get('AccountCode',0),tenantid)
              conn.commit()
      page = int(page)+1
  </code></pre>