## Conclusion

In this lab, you have learned how to connect to TiDB Cluster by Python Code. You have also learned how to use the `mysql-connector-python` library to interact with TiDB. Include connect, insert, query one and query many.

Then, we went through the prepared statements and batch inserts to improve the performance of your application.

After that, we learned how to use `AUTO_RANDOM` to avoid hotspots and how to perform an online schema change without interrupting business.

Finally, we showed you the pessimistic lock and optimistic lock for concurrency control in TiDB.
