PythonのO/RマッパーでSQLを操作できるSQLAlchemyを紹介します。他のPythonライブラリとの連動もしやすいため非常に便利なライブラリです。 O/Rマッパーのメリット/デメリットの記事を参考に貼っておきます。 なおサンプルデータは下記を使用していきます。
TiDB is a MySQL-compatible database, and SQLAlchemy is a popular Python SQL toolkit and Object Relational Mapper (ORM). In this tutorial, you can learn how to use TiDB and SQLAlchemy to accomplish the ...