Lately I have had to use azure storage. Interestingly I found there are Python SDKs to work with Azure storage.
Here’s a sample step-by step procedure :
- Install the azure package.
pip install azure
You are using pip version 7.0.3, however version 8.0.2 is available.
You should consider upgrading via the ‘python -m pip install –upgrade pip’ command.
Collecting azure
Downloading azure-1.0.3.zip
Collecting azure-mgmt==0.20.2 (from azure)
Downloading azure-mgmt-0.20.2.zip
Collecting azure-servicebus==0.20.1 (from azure)
Downloading azure_servicebus-0.20.1-py2.py3-none-any.whl
Collecting azure-storage==0.20.3 (from azure)
Downloading azure_storage-0.20.3-py2-none-any.whl (86kB)
100% |################################| 90kB 819kB/s
Collecting azure-servicemanagement-legacy==0.20.2 (from azure)
Downloading azure_servicemanagement_legacy-0.20.2-py2.py3-none-any.whl (78kB)
100% |################################| 81kB 975kB/s
Collecting azure-mgmt-compute==0.20.1 (from azure-mgmt==0.20.2->azure)
Downloading azure_mgmt_compute-0.20.1-py2.py3-none-any.whl (72kB)
100% |################################| 73kB 890kB/s
Collecting azure-mgmt-network==0.20.1 (from azure-mgmt==0.20.2->azure)
Downloading azure_mgmt_network-0.20.1-py2.py3-none-any.whl (77kB)
100% |################################| 77kB 835kB/s
Collecting azure-mgmt-resource==0.20.1 (from azure-mgmt==0.20.2->azure)
Downloading azure_mgmt_resource-0.20.1-py2.py3-none-any.whl
Collecting azure-mgmt-storage==0.20.0 (from azure-mgmt==0.20.2->azure)
Downloading azure_mgmt_storage-0.20.0-py2.py3-none-any.whl
Collecting azure-common (from azure-servicebus==0.20.1->azure)
Using cached azure_common-1.0.0-py2.py3-none-any.whl
Requirement already satisfied (use –upgrade to upgrade): requests in c:\users\agoswami\appdata\local\continuum\anaconda\lib\site-packages (from azure-servicebus==0.20.1->azure)
Requirement already satisfied (use –upgrade to upgrade): futures in c:\users\agoswami\appdata\local\continuum\anaconda\lib\site-packages (from azure-storage==0.20.3->azure)
Requirement already satisfied (use –upgrade to upgrade): python-dateutil in c:\users\agoswami\appdata\local\continuum\anaconda\lib\site-packages (from azure-storage==0.20.3->azure
)
Collecting azure-nspkg (from azure-storage==0.20.3->azure)
Using cached azure_nspkg-1.0.0-py2.py3-none-any.whl
Collecting azure-mgmt-common (from azure-mgmt-compute==0.20.1->azure-mgmt==0.20.2->azure)
Downloading azure_mgmt_common-0.20.0-py2.py3-none-any.whl
Requirement already satisfied (use –upgrade to upgrade): six>=1.5 in c:\users\agoswami\appdata\local\continuum\anaconda\lib\site-packages (from python-dateutil->azure-storage==0.2
0.3->azure)
Collecting azure-mgmt-nspkg (from azure-mgmt-common->azure-mgmt-compute==0.20.1->azure-mgmt==0.20.2->azure)
Downloading azure_mgmt_nspkg-1.0.0-py2.py3-none-any.whl
Installing collected packages: azure-nspkg, azure-common, azure-mgmt-nspkg, azure-mgmt-common, azure-mgmt-compute, azure-mgmt-network, azure-mgmt-resource, azure-mgmt-storage, azur
e-mgmt, azure-servicebus, azure-storage, azure-servicemanagement-legacy, azure
Running setup.py install for azure-mgmt
Running setup.py install for azure
Successfully installed azure-1.0.3 azure-common-1.0.0 azure-mgmt-0.20.2 azure-mgmt-common-0.20.0 azure-mgmt-compute-0.20.1 azure-mgmt-network-0.20.1 azure-mgmt-nspkg-1.0.0 azure-mg
mt-resource-0.20.1 azure-mgmt-storage-0.20.0 azure-nspkg-1.0.0 azure-servicebus-0.20.1 azure-servicemanagement-legacy-0.20.2 azure-storage-0.20.3
So I start seeing azure packages that I can use.
$ pwd
/cygdrive/c/Users/agoswami/AppData/Local/Continuum/Anaconda
$ find . -iname ‘*azure*’ -type d
./Lib/site-packages/azure
./Lib/site-packages/azure-1.0.3-py2.7.egg-info
./Lib/site-packages/azure_common-1.0.0.dist-info
./Lib/site-packages/azure_mgmt-0.20.2-py2.7.egg-info
./Lib/site-packages/azure_mgmt_common-0.20.0.dist-info
./Lib/site-packages/azure_mgmt_compute-0.20.1.dist-info
./Lib/site-packages/azure_mgmt_network-0.20.1.dist-info
./Lib/site-packages/azure_mgmt_nspkg-1.0.0.dist-info
./Lib/site-packages/azure_mgmt_resource-0.20.1.dist-info
./Lib/site-packages/azure_mgmt_storage-0.20.0.dist-info
./Lib/site-packages/azure_nspkg-1.0.0.dist-info
./Lib/site-packages/azure_servicebus-0.20.1.dist-info
./Lib/site-packages/azure_servicemanagement_legacy-0.20.2.dist-info
./Lib/site-packages/azure_storage-0.20.3.dist-info
./myAzure
2. Import the libraries
from azure.storage.table import TableService
3. Use the apis provided.
Code:
References:
[1] How to use Table storage from Python : https://azure.microsoft.com/en-us/documentation/articles/storage-python-how-to-use-table-storage/
[2] Install the Python SDK for Azure : https://azure.microsoft.com/en-us/documentation/articles/python-how-to-install/