question

aswin-k avatar image
1 Vote"
aswin-k asked ·

How to create Azure SQL "serverless" database instance usig Azure SQL API in python?

I am developing an Azure base solution in Django. In that how can I allow user to login using his Azure Active directory Account and create an SQL server first, then create a "Server-less" instance of database with predefined database name?
Is there any Azure API for this particular requirement?
Making the database server-less is important for my requirement.
I do not have much experience in handling API's, if my approach is wrong please feel free to point out.
Thanks in advance

azure-sql-database
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@aswin-k
Please convey if you need any further information.
Thanks
Navtej S

0 Votes 0 · ·

1 Answer

pituach avatar image
1 Vote"
pituach answered ·

Good day Aswin ( @aswin-k ),

Option 1: Direct work with Azure Python API

Azure have a full Azure libraries (SDK) for Python, which allow you to provisioning, managing, and using Azure resources from Python application code.

The following document is the Python developers entery point to the Azure world:

https://docs.microsoft.com/en-us/azure/developer/python/

The following list the Azure libraries (SDK) for Python:

https://docs.microsoft.com/en-us/azure/developer/python/azure-sdk-overview

And here you have a sample step-by-step to all that you asked and more

https://docs.microsoft.com/en-us/samples/azure-samples/sql-database-python-manage/sql-database-python-manage/ including: Create a SQL Server instance, Create a Firewall rule, List servers by resource group, List servers by subscription, List server usages, Create a database, Get a database, List databases, List database usages, Delete a database, Delete a SQL Server instance.

Option 2: You can use simple Transact-SQL in order to create the database. This is done using simple CREATE DATABASE commant

https://docs.microsoft.com/en-us/sql/t-sql/statements/create-database-transact-sql?view=azuresqldb-current

Note: By the way, I am not working with python and I had no idea what is the solution till 20 minutes ago, but I have a browser and I have Google in the other side. I really think that people should use search engine more before asking for help, and learn how to find their needs as part of their professional ability. Forums are extremely important to get help but should come after the the step of Google. In this case, I simply search for what you ask for using your words: azure api python. and first result was the answer

I hope that this cover your need and was helpful ��



· 2 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@aswin-k are you still with us?!?

Have you read the answer?

0 Votes 0 · ·

Thank you for your answer, I ll try the python API.
And next time I ll Google first ��.

Regards

0 Votes 0 · ·