Construct a Desk API with Python and Azure Cosmos DB
Azure Cosmos DB
Azure Cosmos DB is Microsoft’s globally distributed multi-model database service.
Desk API
Azure Cosmos DB offers Desk API for functions that use Azure Desk storage and wish premium capabilities corresponding to worldwide devoted throughput, single-digit millisecond latency, excessive availability, computerized secondary indexing, and international distribution.
The Desk API consumer SDKs can be found for .NET, .NET Core, Java, Python, and Node.js.
Conditions
- Azure Subscription
- Python 3.7
Step 1. Log in to the Azure portal right here(portral.azure.com).
Step 2. Create a Database account
Click on Create a Useful resource ->Databases ->Azure Cosmos DB.
Step 3. You’ll be able to fill in your primary Particulars.
Click on Overview+create
After Creating
Step 4. Add a Desk
Choose Knowledge Explorer-> New Desk.
Sort throughput is — 400
Click on Okay.
Step 5. Knowledge Explorer shows the brand new database and desk.
Step 6. Add a Pattern Knowledge
In Knowledge Explorer, develop the pattern, choose Entities, after which choose Add Entity.
Step 7. Now add information to the PartitionKey worth field and RowKey worth field, and choose Add Entity.
Step 8. Clone the pattern utility from GitHub
Open the Command Immediate, and run the next code.
md "C:git-samples"
then, run the code.
cd "C:git-samples"
Lastly, run the code.
git clone https://github.com/Azure-Samples/storage-python-getting-started.git
Then, open the supply file in Visual Studio.
Step 9. Replace the Connection String
Within the Azure portal -> Choose Connection String.
- Copy the ACCOUNT NAME.
- Open the config.py file, and paste the ACCOUNT NAME from the portal into the STORAGE_ACCOUNT_NAME worth on line 19.
- Return to the portal and duplicate the PRIMARY KEY.
- Paste the PRIMARY KEY from the portal into the STORAGE_ACCOUNT_KEY worth on line 20.
- Save the config.py file.
Step 10. Run the app
- In Visual Studio, right-click on the challenge in Answer Explorer, choose the present Python atmosphere, then right-click.
- Choose Set up Python Package deal, then enter azure-storage-table
- Run F5 to run the applying. Your app shows in your browser.
Conclusion
That is all. We realized about the way to use Python and Azure Cosmos DB Desk API to construct an app by cloning an instance from Github. I hope you perceive this idea of Cosmos DB.
Know extra about our firm at Skrots. Know extra about our companies at Skrots Companies, Additionally checkout all different blogs at Weblog at Skrots
Know more about our company at Skrots. Know more about our services at Skrots Services, Also checkout all other blogs at Blog at Skrots
Thanks, Harsh
Founder | CEO — Skrots
Learn more about our blog at Blog at Skrots. Checkout our list of services on Skrots. Give a look at our website design at Skrots . Checkout our LinkedIn Page at LinkedIn.com. Check out our original post at https://blog.skrots.com/build-a-table-api-with-python-and-azure-cosmos-db/?feed_id=5884&_unique_id=66272d8da36d1