Skip to main content

A Python Wrapper for modeling client side encrypted azure storage tables, queues and blobs

Project description

[![Build Status](](

# azurestoragewrap

> A Python Wrapper for modeling client side encrypted azure storage tables, queues and blobs

Inspired by the conversion of data modeling in [SQLAlchemy]( lib - What the great Job! Thank You! -, i wrote this little wrapper around the [Azure Storage SDK for Python]( to simplify modeling data structures and easily implement Client Side Encryption for my own needs.
Would be lucky if this lib helps other peoples too. GitHub Issues, Stars, Forks and Contribution are Welcome! Have fun with azurestoragewrap.

Microsoft Azure Storage is a Microsoft-managed cloud service that provides storage that is highly available, secure, durable, scalable, and redundant. Azure Storage consists of Blob storage, Table Storage, and Queue storage.
All Data can be accessed from anywhere in the world via HTTP or HTTPS.

## Getting started

Get azurestoragewrap via pip

pip install azurestoragewrap

## Usage examples

Using azurestoragewrap should be as easy as possible and has to be handle in a few steps:
- config Your settings, incl. Your Azure Storage Credentials in a python dictionary
- model Your Data Objects as a subclass of StorageTableModel, StorageQueueModel or StorageBlobModel
- initiate the StorageContext
- register Your Model to the StorageContext

### Configuration

Configure as followed

config = {
'AZURE_KEY_IDENTIFIER': 'azurestoragewrap_test',
'AZURE_SECRET_KEY': 'supa-dupa-secret-special-key2901'

### Table

Azure Table storage stores large amounts of structured data. The service is a NoSQL datastore which accepts authenticated calls from inside and outside the Azure cloud. Azure tables are ideal for storing structured, non-relational data. To handle Table Data you have to model your Table structure like this:
# Model without encryption
class TableOne(StorageTableModel):
Id = PartitionKey(0) #You have to define one Property as PartitionKey (Part of Azure Storage Table Primary Key) with a default Value
Id2 = RowKey('') #You have to define one Property as RowKey (Part of Azure Storage Table Primary Key) with a default Value

#Model with Partly encryption
class TableTwo(StorageTableModel):
Id = PartitionKey('')
Id2 = RowKey('')
Secret = EncryptKey('') # a Property you like to en-/decrypt clientside has to define as "EncryptKey" with an default Value
NonSecret = ''
Secret2 = EncryptKey('second encrypt') # of cause you can mix multiple encrypted and non encrypted Properties in a Table Model

Now you can initiate Your StorageTableContext and register your Model:
db = StorageTableContext(**testconfig)

Now get started:
entity = TableOne()
entity.Id = 1
entity.Id2 = 'Test'
entity = db.insert(entity)

entity = db.get(TableOne(Id=1, Id2='Test'))


#Replace or Merge (encrypted or not)

writeentity = TableTwo(Id=1, Id2 ='test_partly_encryption', Secret='Secret', NonSecret='')
writeentity = db.insert(writeentity)

mergeentity = TableTwo(Id=1, Id2 ='test_partly_encryption', Secret='', NonSecret='NonSecret')
mergeentity = db.merge(mergeentity)

### Queue

Azure Queue storage is a service for storing large numbers of messages - e.g. a backlog of work to process asynchronously.

Give an example

### Blob

Azure Blob storage is a service for storing large amounts of unstructured object data, such as text or binary data - e.g. to serve images or documents directly to a browser.

Give an example

## Meta

* **Oliver Meyer** - *app workshop UG (haftungsbeschrnkt)* - [omza on github](

This project is licensed under the MIT License - see the [LICENSE](LICENSE.txt) file for details

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azurestoragewrap-0.0.9.tar.gz (13.3 kB view hashes)

Uploaded source

Built Distribution

azurestoragewrap-0.0.9-py3-none-any.whl (16.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page