English | 中文
tidb-example-python is a sample project written by PingCAP for Python to connect to TiDB. You can find the following examples here.
Driver
- PyMySQL example
- mysqlclient example
- mysql-connector-python example
ORM
- SQLAlchemy example
- peewee example
Framework
- Django example
Scenario
- Serverless Tier connection example
- Butch delete example
- Butch update example
- Avoid write skew example
- Optimistic and pessimistic transaction example
make test
Using run the peewee_example.py
script as an example:
-
Install dependcy.
pip install -r requirement.txt
-
Initial the table.
mycli --host 127.0.0.1 --port 4000 -u root --no-warn < player_init.sql
-
Run the script.
python3 peewee_example.py