3. Storage

DStore provides an abstraction layer to store the model instances.

3.1. Memory

3.1.1. Introduction

The default storage in DStore is the MemoryStore.

This simply stores the model instances in an array in memory.

Keep in mind that this storage type is runtime only, meaning that the data is wiped when the application closes.

3.1.2. Usage

from dstore import MemoryStore
store = MemoryStore( models )

3.2. MySQL

3.2.1. Introduction

This storage type allows model instances to be stored in a MySQL DataBase.

In order to use this storage type, you need to install the Python Package for it.

3.2.2. Installing

You have two choices to install dstore-mysql, using pip or from source.

3.2.2.1. From PyPi

DStore is available from the PyPi repository at DStore.

This means that all you have to do to install PyMan is run the following in a console:

$ pip install dstore-mysql

3.2.2.2. From Source

DStore can also be installed from source by downloading from GitHub and running setup.py.

$ wget https://github.com/MarkLark/dstore-mysql/archive/master.tar.gz
$ tar xvf master.tar.gz
$ cd dstore-mysql-master
$ python setup.py install

3.2.3. Requirements

DStore-MySQL requires the Python package MySQL-python.

3.2.4. Usage

from dstore_mysql import MySQLStore
store = MySQLStore( models )

3.3. MongoDB

3.3.1. Introduction

This storage type allows model instances to be stored in a Mongo DataBase.

In order to use this storage type, you need to install the Python Package for it.

3.3.2. Installing

You have two choices to install dstore-mongo, using pip or from source.

3.3.2.1. From PyPi

DStore-Mongo package is available from the PyPi repository.

This means that all you have to do to install PyMan is run the following in a console:

$ pip install dstore-mongo

3.3.2.2. From Source

DStore-Mongo can also be installed from source by downloading from GitHub and running setup.py.

$ wget https://github.com/MarkLark/dstore-mongo/archive/master.tar.gz
$ tar xvf master.tar.gz
$ cd dstore-mongo-master
$ python setup.py install

3.3.3. Requirements

DStore-Mongo requires the Python package PyMongo.

3.3.4. Usage

from dstore_mongo import MongoStore
store = MongoStore( models )