Python3 mysqlclient-1.3.6 (aka PyMySQL) usage?

后端 未结 1 1046
栀梦
栀梦 2020-12-30 03:03

Im still very much learning python and all the different ways to use 3rd party modules. I have installed https://pypi.python.org/pypi/mysqlclient which was recommended here

相关标签:
1条回答
  • 2020-12-30 03:26

    The PyMySQL project includes a user guide. It’s not so easy to find this guide (there are no obvious links) and to add to the confusion, the module name does not correspond with the package name. To use it, you need:

    import MySQLdb
    

    The MySQLdb module implements PEP 249 - the Python Database API Specification for accessing databases. When using this API, Python code should be more portable across different relational database management systems.

    It’s not recommended to use the _mysql module (which is also included in this package). It’s not portable and it works at a lower level of abstraction (implementing the MySQL C API).

    Here are two tutorials that you might find useful. I’ve used them with the original MySQLdb package in Python 2 but the API is the same (as defined by PEP-249). They both contain practical examples of database access (reading and writing data) and I found them to be better for getting started with the API than the official documentation.

    • Writing MySQL Scripts with Python DB-API, Paul DuBois
    • MySQL Python tutorial
    0 讨论(0)
提交回复
热议问题