数据库¶

数据库¶

数据库¶

DB-API¶

The Python Database API (DB-API) defines a standard interface for Python

database access modules. It’s documented in PEP 249.

Nearly all Python database modules such as sqlite3, psycopg and

mysql-python conform to this interface.

Tutorials that explain how to work with modules that conform to this interface can be found

here and

here.

SQLAlchemy¶

SQLAlchemy is a commonly used database toolkit.

Unlike many database libraries it not only provides an ORM layer but also a

generalized API for writing database-agnostic code without SQL.

$ pip install sqlalchemy

Records¶

Records is minimalist SQL library,

designed for sending raw SQL queries to various databases. Data can be used

programmatically, or exported to a number of useful data formats.

$ pip install records

Also included is a command-line tool for exporting SQL data.

Django ORM¶

The Django ORM is the interface used by Django

to provide database access.

It’s based on the idea of

models,

an abstraction that makes it easier to manipulate data in Python.

The basics:

Each model is a Python class that subclasses django.db.models.Model.

Each attribute of the model represents a database field.

Django gives you an automatically-generated database-access API; see

Making queries.

peewee¶

peewee is another ORM with a focus

on being lightweight with support for Python 2.6+ and 3.2+ which supports

SQLite, MySQL and Postgres by default. The

model layer

is similar to that of the Django ORM and it has

SQL-like methods

to query data. While SQLite, MySQL and Postgres are supported out-of-the-box,

there is a collection of add-ons

available.

PonyORM¶

PonyORM is an ORM that takes a different approach to

querying the database. Instead of writing an SQL-like language or boolean

expressions, Python’s generator syntax is used. There’s also an graphical

schema editor that can generate PonyORM entities for you. It supports Python

2.6+ and Python 3.3+ and can connect to SQLite, MySQL, Postgres & Oracle

SQLObject¶

SQLObject is yet another ORM. It supports a wide

variety of databases: Common database systems MySQL, Postgres and SQLite and

more exotic systems like SAP DB, SyBase and MSSQL. It only supports Python 2

from Python 2.6 upwards.

相关推荐

阿衰online
亚博和365是一家的吗

阿衰online

📅 06-29 👁️ 7163
《火影》九大尾兽你了解多少它们的特点和实力又是如何
体育外围app网站365

《火影》九大尾兽你了解多少它们的特点和实力又是如何

📅 06-29 👁️ 9099
1岁宝宝如何喂养?一日三餐还喝粥?这样安排,娃长得更高
平方米换算市亩
365bet娱乐网站

平方米换算市亩

📅 06-30 👁️ 717
广式枧水粽
体育外围app网站365

广式枧水粽

📅 06-30 👁️ 518
大华摄像头的性能及优势分析(大华摄像头的功能介绍及用户体验评价)