Feature Request: add support for custom connections

Bug #513378 reported by Poldy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Connector/Python
Confirmed
Wishlist
Unassigned

Bug Description

I needed a custom Connection (TCP inside a Paramiko channel). Subclassing MySQLBaseConnection went mostly as expected (only thing here was, I needed to rewrite recv(), because a Paramiko channel doesn't accept a sockets_flag parameter).

The one thing that was not so nice was, that I needed to subclass MySQL (mysql.connector.MySQL). It would be nice to have some way of using an existing connection object when creating a MySQL object. One way would be to append a parameter to __init__ and when that parameter (let's call it connection) is set, use that connection instead of creating a new one in _set_connection.

Anyway, this piece of code is great.....

Revision history for this message
Geert JM Vanderkelen (geertjmvdk) wrote :

Thanks!
Yes, that's a good idea. It was actually meant to be that way, just like you can set the converter class for example.

For class MySQL
a) add a method set_connection_class()
b) allow connection_class as argument to _init_()

Will add that.
Pretty cool use of Paramiko there. I would rather not include to much dependencies, but maybe we'll add something similar later. (first SSL though)

Cheers,
Geert

Changed in myconnpy:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Geert JM Vanderkelen (geertjmvdk) wrote :

I think this will be easier with the refactored code. Stay tuned for next releases! (When, I can not say).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.