Just replace and with the correct values for your environment. Your connection string is something like: DRIVER= SERVER=. DATABASE= UID=PythonWebApp PWD=a987REALLY#$%TRONGpa44w0rd You also want to enable development environment for Flask: The connections string is not saved in the python code for security reasons, so you need to assign it to an environment variable in order to run the sample successfully.
\venv\Scripts\activateĪnd then install all the required packages: pip install -r requirements Then activate the created virtual environment. For example: virtualenv venv -python C:\Python37\ Clone this repo in a directory on our computer and then create a virtual environment. Make sure you have Python 3.7 installed on your machine. If you need any help in executing the SQL script, you can find a Quickstart here: Quickstart: Use Azure Data Studio to connect and query Azure SQL database Run sample locally Once the sample database has been installed, you need to add some stored procedures that will be called from Python. Restore WideWorldImporters Database Add Database Objects Install WideWorldImporters sample database:
In order to run this sample, the WideWorldImporters database is needed. Beside that the native JSON support that Azure SQL provides does all the heavy lifting so sending data back and forth to the database is as easy as sending a JSON message. Wondering what's the magic behind? The sample uses the well known Flask micro-framework and the flask-restful package to easily implement REST APIs. Thanks to native JSON support, creating a REST API with Azure SQL and Python is really a matter of a few lines of code.