Database classification
There are three early database models, namely hierarchical database, network database and relational database.
In today's Internet, databases are usually divided into two categories, namely relational databases and non-relational databases.
Relational Database
A relational database refers to a database that uses a relational model to organize data, and a relational model is a data organization composed of two-dimensional tables and their connections.
advantage:
1、 Easy to maintain: use table structure and consistent format;
2、 Easy to use: SQL is universal and can be used for complex queries;
3、 Complex operation: Supports SQL and can be used for very complex queries between one table and multiple tables.
Disadvantages:
1、 The read and write performance is relatively poor, especially the high-efficiency read and write of massive data;
2、 Fixed table structure, less flexibility;
3、 With high concurrent read and write requirements, hard disk I/O is a big bottleneck for traditional relational databases.
The current mainstream relational databases are
MYSQL
Currently the most widely used open source, multi-platform relational database, supports transactions, complies with ACID, and supports most SQL specifications
Support transactions, comply with ACID, support most SQL specifications, belong to commercial software, need to pay attention to copyright and license authorization fees
Oracle
Supports transactions, conforms to relational database principles, conforms to ACID, supports most SQL specifications, and is the most powerful and complex commercial database with the highest market share
Postgresql
Open source, multi-platform, relational database, the most powerful open source database, requires a python environment, Postgresql-based TimeScaleDB is currently one of the most popular time series databases. (For more learning content, please click on the python learning network)
Non-relational database
Non-relational databases are also called NOSQL (Not Only SQL). As a supplement to relational databases, they can exert high efficiency and performance in specific scenarios and characteristic problems.
Common non-relational database types include key-value storage databases and document-oriented databases
Key-value storage databases are similar to hashes. They can be added, deleted, and inquired through keys, and have high performance. The advantages are simplicity, easy deployment, and high concurrency. The main products are
Open source, Linux platform, key-value key-value Nosql database, simple and stable, very mainstream, full-data in-momory, and "fast" key-value nosql database
Memcaced
An open source, high-performance, distributed memory object caching system, which can reduce database load and accelerate dynamic web applications
**The document-oriented database is stored in the form of documents. Each document is a collection of a series of data items. Each data item has a name and a corresponding value. The main products are **
Open source, multi-platform, document-based nosql database, "most like a relational database", positioned as a "flexible" nosql database. It is suitable for website background database (fast update, real-time copy), small file system (json, binary), log analysis system (files with large data volume).
Knowledge point expansion:
Python database support
After more than two months of learning, we have probably finished learning the basic syntax of Python. Next, we will gradually apply what we have learned to the application level. Today, what we are going to learn is to use Python to realize database connection.
Let's talk about what api is. In the learning of programming language, we often come into contact with the word api. So what is api, in simple terms, is an interface, like java api, there is a special api document provided Inquire. The api of the Python database is the DB API. The api version we mainly talk about is DB API2.0.
The Python DB API has three module attributes:
1、 apilevel: This attribute is mainly used to define the version of the Python DB API used, like the DB API 2.0 we mentioned above;
2、 threadsafety: This is used to define the thread safety of the module;
This parameter is an integer from 0 to 3. 0 means that threads cannot share modules, 1 means threads can share modules themselves, 2 means threads can share modules and connections, but cannot share cursors, and 3 means modules are absolutely thread-safe.
3、 paramstyle: This attribute defines which parameter style is used in the SQL query. Here is an explanation, SQL refers to the meaning of the database.
We won't talk about this in detail, because if you have just come into contact with new knowledge and introduce this knowledge point, you will easily feel confused.
So far, this article on which databases can be used by python is introduced. For more relevant python-supported database content, please search for previous articles on ZaLou.Cn or continue to browse related articles below. Hope you will support ZaLou.Cn more in the future!
Recommended Posts