pythonmysqlpandasazure-functionsquandl

Azure function returning HTTP code 202 while trying to Test/Run


I am new to azure functions and trying to schedule a python script through Azure Functions. The script is returing following response:

2021-10-08T12:15:00Z   [Information]   Executing 'Functions.quandldb_update' (Reason='Timer fired at 2021-10-08T12:15:00.0108672+00:00', Id=bf5b53e4-25ed-4d34-aa9e-ffeb91078470)
2021-10-08T12:15:00Z   [Verbose]   Sending invocation id:bf5b53e4-25ed-4d34-aa9e-ffeb91078470
2021-10-08T12:15:00Z   [Verbose]   Posting invocation id:bf5b53e4-25ed-4d34-aa9e-ffeb91078470 on workerId:835d8896-9373-4d72-bd44-dca2bc44a708
2021-10-08T12:15:00Z   [Error]   Executed 'Functions.quandldb_update' (Failed, Id=bf5b53e4-25ed-4d34-aa9e-ffeb91078470, Duration=24ms)

My Http Response Code is : 202 Accepted And response body is empty

I am running the below code:

## Libraries needed ##
import quandl
import pandas as pd
import numpy as np
from sqlalchemy import create_engine
import azure.functions as func
def main(req: func.HttpRequest):
    pd.DataFrame(columns={"ABCD","EFGH"}).to_sql('mry_balance_sheet_test', con=engine, if_exists='append', chunksize=1000)

I have added pandas and other imports in requirements.txt

Please find below function.json:

{
  "scriptFile": "rawvalues_push.py",
  "bindings": [
    {
      "name": "mytimer",
      "type": "timerTrigger",
      "direction": "in",
      "schedule": "0 */5 * * * *"
    }
  ]
}

I want to create/update table in my database by calling quandl api. The script is running fine locally on my system, please help me in creating azure function for the same


Solution

  • If it is working fine in the local, then it should work after deploying the function as well.

    Also, the code and functions.json looks good, So you missed to add local.settings.json in the portal Application settings as below:

    enter image description here