简体   繁体   English

关于 DB-API e SQLAlchemy 的疑惑

[英]doubts about DB-API e SQLAlchemy

link da questão 链接 da questão

在此处输入图片说明

Briefly, I want to know what this "DB-API" mechanism is.简而言之,我想知道这个“DB-API”机制是什么。

Are there multiple DB-APIs (there are more than 1 DB-API)?是否有多个 DB-API(有 1 个以上的 DB-API)?

Is it just a 'rules' document?它只是一个“规则”文件吗?

have a source code?有源代码吗?

What is it for?它是做什么用的?

Is psycopg2 an example of a DB-API or is it a library that follows DB-APIs standards? psycopg2 是 DB-API 的示例还是遵循 DB-API 标准的库?

Is the DB-API specified in SQLAlchemy a SQLAlchemy-specific DB-API (if that is possible)? SQLAlchemy 中指定的 DB-API 是否是 SQLAlchemy 特定的 DB-API(如果可能)?

I think that's it !!!我想就是这样!!!

Regarding the dialect, I ask another question later.关于方言,我稍后再问一个问题。

The python db api is defined in https://www.python.org/dev/peps/pep-0249/ and I believe just a spec or as you say rules document. python db api 是在https://www.python.org/dev/peps/pep-0249/ 中定义的,我相信只是一个规范或正如你所说的规则文档。

Modules like psycopg2 fulfill those requirements, so are an implementation of that api.像 psycopg2 这样的模块满足这些要求,该 API 的实现也是如此。 SqlAlchemy allows you to swap out which db api implementation you use so you can change your underlying database server or use features offered by another driver/db api implementation and still use the same database server. SqlAlchemy 允许您换出您使用的 db api 实现,以便您可以更改底层数据库服务器或使用另一个驱动程序/db api 实现提供的功能,并且仍然使用相同的数据库服务器。

As I understand it SqlAlchemy supports multiple db api implementations which you specify using a connection uri, explained here https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls .据我了解,SqlAlchemy 支持您使用连接 uri 指定的多个 db api 实现,在此处解释https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM