Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌐 Update SQLAlchemy instruction in Chinese translation docs/zh/docs/tutorial/sql-databases.md #9712

Merged
merged 10 commits into from Jan 9, 2024
15 changes: 14 additions & 1 deletion docs/zh/docs/tutorial/sql-databases.md
Expand Up @@ -77,10 +77,22 @@ ORM 具有在代码和数据库表(“*关系型”)中的**对象**之间
该文件`__init__.py`只是一个空文件,但它告诉 Python 其中`sql_app`的所有模块(Python 文件)都是一个包。

现在让我们看看每个文件/模块的作用。
## 安装 SQLAlchemy

先下载`SQLAlchemy`所需要的依赖:
<div class="termy">

```console
$ pip install sqlalchemy

---> 100%
```

</div>

## 创建 SQLAlchemy 部件

让我们涉及到文件`sql_app/database.py`。
让我们转到文件`sql_app/database.py`。

### 导入 SQLAlchemy 部件

Expand Down Expand Up @@ -112,6 +124,7 @@ SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db"

如果您想使用不同的数据库,这是就是您必须修改的地方。


### 创建 SQLAlchemy 引擎

第一步,创建一个 SQLAlchemy的“引擎”。
Expand Down