Search code examples
pythonmysql-connector-pythonmysql-connector-c

Standard Connection Pool for Connector/Python C Extension?


I am working with MySQL's Connector/Python C Extension as I needed access to the originating table for each column in the result. The C extension provides this via the ‘fetch_fields()’ call, which appears to be unavailable in basic Connector/Python (no C extension).

The Connector/Python is equipped with a connection pooling mechanism; e.g. MySQLConnectionPool. However, I haven't found similar functionality for the C extension.

Is there a standard pooling mechanism for the C extension? I thought about using MySQLConnectionPool’s add connection method to populate the connection pool with C extension connections but the interface to the C extension is quite different than the standard interface so I am expecting this to cause problems.


Solution

  • Connection Pooling is not supported by the C Extension in Connector/Python yet. A CMySQLConnectionPool should be implemented. Hacking MySQLConnectionPool to use a CMySQLConnection object should not work.