title: Python Azure Function failing with AttributeError('__enter__') after updating Azure Core Tools
body: <p>I have a Azure Function Python script. It has a http trigger and connects to a MySQL DB and gets the rows from a table and processes it. I use VS Code to develop it and test it using the Python vEnv. (aka pressing F5 to run it locally)</p>
  <p>It used to work perfectly for a long time but a week ago I updated my VS Code and the Azure core tools, did some minor changes, deployed and now it doesn't work, when running in Azure it throws some cryptic error <code>AttributeError('__enter__')</code>. So I went back to VS Code, run it in the vEnv and it works just fine there. So the issue only happens when running on Azure Functions.</p>
  <p>Google did not help much I managed to find that it might relate to the <code>with</code> part for <code>pymysql</code>. I did some debugging with logging right before and after the <code>with</code> block and it does seem to fail exactly there. But I'm stuck and not sure how to debug any further.</p>
  <p>It is not related to the code change that I did, I am convinced that something happened when I updated the VS Code Azure Functions runtime or something in Azure itself has changed.</p>
  <p>I have installed <code>Python 3.8.2 64-bit vEnv</code> and the Azure core tools version <code>3.0.2630</code></p>
  <p>Here is the seemingly relevant part of the code:</p>
  <pre><code>def getDbData(connection,table):
      with connection: 
          cur = connection.cursor()
          cur.execute(f&quot;SELECT * FROM {table}&quot;)
          rows = cur.fetchall()
  
      if len(rows) &gt; 0:
          logging.info(f'Got {len(rows)} entries from {table} SQL table!')
          connection.commit()
          for row in rows:
              logging.info(f'do something with each row')
      else:
          logging.info(f'Did not get any results from {table} SQL table!')
          connection.commit()
  
  
  connection = pymysql.connect(host='hostname',user='SA',password='Passw',db='database',charset='utf8',use_unicode=True,cursorclass=pymysql.cursors.DictCursor)
  
  dbindex = getDbData(connection,&quot;dbTable&quot;)
  </code></pre>