I am developing a azure function on my local with python v2. I am trying to connect my local function to a local mysql db, but I can’t because I don’t have function.json file.
V2 model does not use funtion.json file. Where Shall I setup that data then?
When I read doc https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-azure-sql-input?tabs=isolated-process%2Cnodejs-v4&pivots=programming-language-python#http-trigger-get-row-by-id-from-query-string-5 , which I am trying to follow, It tells you to setup some things in function.json file. However, that file is only in python v1 programming model, but not in v2.
2
Answers
Thanks @Vivek Vaibhav Shandilya for clarifying "Yes, Model V2 does not have function.json. bindings are defined inside the function_app.py file."
So simply solved it using mysql-connector-python (https://pypi.org/project/mysql-connector-python/) in my function_app.py file. Here is an example of what I have added:
Currently Python programming model v2 does not support
SQL Trigger
,SQL Input
,SQL Output
.When you create function using
func
command python model V2 is default selected.and there is no option to select
SQL trigger
,SQL Input
,SQL Output
in model V2.If you want to create in V1 model you need to mention model v1 in the command.
bash command
:Result :
new function will be created with
function.json
filefunction.json
:In VS Code :
VS Code
:after selecting the programming language, option will be given to select model.