Skip to content

Commit

Permalink
add disconnect handling note when using sqlalchemy against TiDB Serve…
Browse files Browse the repository at this point in the history
…rless (#17285) (#17293)
  • Loading branch information
ti-chi-bot authored May 9, 2024
1 parent 9544cfa commit 9735a2d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions develop/dev-guide-sample-application-python-sqlalchemy.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ SQLAlchemy 是一个支持多种数据库的 ORM 库。它是对数据库的高

<div label="TiDB Serverless">

> **注意:**
>
> TiDB Serverless 集群目前存在一个限制:如果 5 分钟内没有活跃连接,集群将会自动关闭,这会导致所有连接中断。因此,当使用 SQLAlchemy 连接到 TiDB Serverless 集群时,从连接池中获取的连接可能会遇到 `OperationalError` 报错,例如 `Lost connection to MySQL server during query``MySQL Connection not available`。为了避免该错误,可将 `pool_recycle` 参数设置为 `300`。更多信息,请参阅 SQLAlchemy 文档 [Dealing with Disconnects](https://docs.sqlalchemy.org/en/20/core/pooling.html#dealing-with-disconnects)
1. 在 TiDB Cloud 的 [**Clusters**](https://tidbcloud.com/console/clusters) 页面中,选择你的 TiDB Serverless 集群,进入集群的 **Overview** 页面。

2. 点击右上角的 **Connect** 按钮,将会弹出连接对话框。
Expand Down

0 comments on commit 9735a2d

Please sign in to comment.