Skip to content

Commit

Permalink
Preview PR pingcap/docs#14544 and this preview is triggered from commit
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Aug 24, 2023
1 parent 2ea10cb commit 5b75e9a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Support level: **Compatible**

You can follow the [mysqlclient documentation](https://pypi.org/project/mysqlclient/) to download and configure the driver. It is recommended to use mysqlclient 2.1.1 or later versions.

For an example of using mysqlclient to build a TiDB application, see [Connect TiDB with mysqlclient](/develop/dev-guide-sample-application-python-mysqlclient.md).
For an example of using mysqlclient to build a TiDB application, see [Connect to TiDB with mysqlclient](/develop/dev-guide-sample-application-python-mysqlclient.md).

</div>
<div label="MySQL Connector/Python">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ with get_connection(autocommit=True) as connection:
For complete examples in Python, see:

- [Use PyMySQL to build a simple CRUD app with TiDB and Python](/develop/dev-guide-sample-application-python-pymysql.md#step-2-get-the-code)
- [Connecting to TiDB cluster with mysqlclient](https://github.com/tidb-samples/tidb-python-mysqlclient-quickstart)
- [Connect to TiDB with mysqlclient](https://github.com/tidb-samples/tidb-python-mysqlclient-quickstart)
- [Use MySQL Connector/Python to build a simple CRUD app with TiDB and Python](/develop/dev-guide-sample-application-python-mysql-connector.md#step-2-get-the-code)
- [Use SQLAlchemy to build a simple CRUD app with TiDB and Python](/develop/dev-guide-sample-application-python-sqlalchemy.md#step-2-get-the-code)
- [Use peewee to build a simple CRUD app with TiDB and Python](/develop/dev-guide-sample-application-python-peewee.md#step-2-get-the-code)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
---
title: Connect TiDB with mysqlclient
title: Connect to TiDB with mysqlclient
summary: Learn how to connect TiDB using mysqlclient. This tutorial gives Python sample code snippets that work with TiDB using mysqlclient.
---

<!-- markdownlint-disable MD024 -->
<!-- markdownlint-disable MD029 -->

# Connect TiDB with mysqlclient
# Connect to TiDB with mysqlclient

TiDB is a MySQL-compatible database, and [mysqlclient](https://github.com/PyMySQL/mysqlclient) is a popular open-source driver for Python.

Expand Down Expand Up @@ -265,16 +262,16 @@ For more information, refer to [Update Data](/develop/dev-guide-delete-data.md).
### Using driver or ORM framework?
The Python driver provides low-level access to the database, but it also requires the developers to:
The Python driver provides low-level access to the database, but it requires the developers to:
- Establish and release database connections manually.
- Manage database transactions manually.
- Map data rows (represented as tuples in the `mysqlclient`) to data objects manually.
- Manually establish and release database connections.
- Manually manage database transactions.
- Manually map data rows (represented as tuples in `mysqlclient`) to data objects.
Unless you need to write complex SQL statements, it is recommended to use [ORMs](https://en.wikipedia.org/w/index.php?title=Object%E2%80%93relational_mapping) for developing. They can help you:
Unless you need to write complex SQL statements, it is recommended to use [ORMs](https://en.wikipedia.org/w/index.php?title=Object%E2%80%93relational_mapping) for development. They can help you:
- Reduce [boilerplate code](https://en.wikipedia.org/wiki/Boilerplate_code) for managing connections and transactions.
- Manipulate data with data objects instead of an amount of SQL statements.
- Manipulate data with data objects instead of a number of SQL statements.
## Next steps
Expand Down

0 comments on commit 5b75e9a

Please sign in to comment.