3

I have a Python webapp deployed on Azure App Service (supposedly a simple way to deploy a webapp). I want it to write to a SQL database (Azure SQL). That's it.

This led me down a rabbit-hole. The support for this use-case is abysmal!

  • To write to a database, I need pyodbc.
  • To install pyodbc I need gcc on Linux because it needs to compile (no wheels available).
  • Azure App Service (for Linux; App Service for Windows with a Python runtime is deprecated) does not include gcc, so I have to use a custom container which means:
    • Writing a Dockerfile
    • and spinning up a private Azure Container Registry (and configuring credentials; service principals don't work because I don't have permissions to Azure AD in my subscription).

This seems unfathomably complicated. I just want my web app to write to a database. Is there a simpler way to achieve this on Azure App Service/Python?

Gilead
  • 1,263
  • 10
  • 21
  • One possibility is to forget about custom containers, and use a [custom bash script](https://learn.microsoft.com/en-us/azure/app-service/containers/how-to-configure-python#customize-build-automation) to install all dependencies. – Gilead Mar 05 '20 at 22:43

1 Answers1

0

Taking the same problem from another angle... it appears to me that since you need to install ODBC anyway the serverless DB and the app service are incompatible.

This link says:

Azure offers both relational and non-relational databases as managed services. Easily add these to your Python apps, choosing from among managed solutions for PostgreSQL and MySQL, Redis, Azure Cosmos DB (compatible with MongoDB) and other services.

Notable lack of Azure SQL DB. If anyone HAS a method for using these 2 things together I'm all ears.

frogg
  • 55
  • 1
  • 10