Introduction and use of the nosql database CodernityDB developed in Python only, nosqlcodernitydb

Source: Internet
Author: User
Tags import database

Introduction and use of the nosql database CodernityDB developed in Python only, nosqlcodernitydb

Look at this logo. It's a bit python-like. The database codernityDB introduced this time is developed in python only.

I used the tinyDB local database and an api service. At first, I thought the speed was a little poor. The result showed that the implementation method was really amazing, it is actually the storage of json, and there is no binary compression. The CodernityDB introduced here is also a pure developed small database.

CodernityDB is an open-source, pure Python language (without third-party dependencies), fast, multi-platform NoSQL database. It has options to support the HTTP service version (CodernityDB-HTTP), and the Python client library (CodernityDB-PyClient), which is designed to be 100% compatible with embedded versions.

Main features

1. native support for Pyhon
2. Multiple indexes
3. Fast (up to 50 000 insert operations per second)
4. the embedded mode (default) and server mode (CodernityDB-HTTP), along with the client library (CodernityDB-PyClient), are 100% compatible
5. Easy customer Storage

CodernityDB database operation code instance:

Copy codeThe Code is as follows:
Insert (simple)
 
From CodernityDB. database import Database
 
Db = Database ('/tmp/tut1 ')
Db. create ()
 
InsertDict = {'X': 1}
Print db. insert (insertDict)
 
 
 
 
Insert
 
From CodernityDB. database import Database
From CodernityDB. hash_index import HashIndex
 
Class WithXIndex (HashIndex ):
Def _ init _ (self, * args, ** kwargs ):
Kwargs ['key _ format'] = 'I'
Super (WithXIndex, self). _ init _ (* args, ** kwargs)
 
Def make_key_value (self, data ):
A_val = data. get ("x ")
If a_val is not None:
Return a_val, None
Return None
 
Def make_key (self, key ):
Return key
 
Db = Database ('/tmp/tut2 ')
Db. create ()
 
X_ind = WithXIndex (db. path, 'x ')
Db. add_index (x_ind)
 
Print db. insert ({'X': 1 })
 
 
 
Count
 
From CodernityDB. database import Database
 
Db = Database ('/tmp/tut1 ')
Db. open ()
 
Print db. count (db. all, 'x ')
 
 
Get
 
From CodernityDB. database import Database
 
Db = Database ('/tmp/tut2 ')
Db. open ()
 
Print db. get ('x', 1, with_doc = True)
 
 
Delete
 
From CodernityDB. database import Database
 
Db = Database ('/tmp/tut2 ')
Db. open ()
 
Curr = db. get ('x', 1, with_doc = True)
Doc = curr ['Doc']
 
Db. delete (doc)
 
 
 
Update
 
From CodernityDB. database import Database
 
Db = Database ('/tmp/tut2 ')
Db. create ()
 
Curr = db. get ('x', 1, with_doc = True)
Doc = curr ['Doc']
 
Doc ['updated'] = True
Db. update (doc)


Can nosql databases be used for website development?

Clearly stated, is it necessary to rely entirely on nosql databases for website development or is it only used for assistance?
Nosql is suitable as an aid. If nosql is solely responsible for the database, only mongodb functions are sufficient, and other mainstream nosql functions are insufficient to replace traditional databases.

Nosql Database

NoSQL does not have the same standards as traditional relational databases, nor is it universal. Therefore, select the appropriate NoSQL Based on the application and data access features.
If you have never been familiar with NoSQL before, MongoDB is a good choice. It supports the most powerful NoSQL in terms of query capability. The disadvantage is the indexing cost and document size limitation.
If you use Hadoop big data analysis, there are basically no changes to the data, just insert and query, and you need to cooperate with Hadoop's MR task, HBase will be a good choice.
Casaandra is a good choice if it requires strong scalability and high concurrency read/write and easy maintenance.
Of course, apart from the three popular NoSQL databases above, there are also many excellent NoSQL databases, and they all have their respective fields of expertise, therefore, you need to understand the characteristics of your products and then analyze which one is the most suitable. Generally, in a large system, it is not a single database, but a combination of multiple databases.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.