| From: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
|---|---|
| To: | Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net> |
| Cc: | psycopg(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Feature branches merged to master for 2.8 release |
| Date: | 2018-10-29 12:12:56 |
| Message-ID: | CA+mi_8bE7Z5BZ3O6Q1QxbCFtfBTthcNAaVa65GQs+sUTZbroTg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | psycopg |
On Mon, Oct 29, 2018 at 10:54 AM Karsten Hilbert
<Karsten(dot)Hilbert(at)gmx(dot)net> wrote:
> Apart from a wrapper class one can always monkey-patch
>
> my_dbapi_instance._get_native_connection = my_dbapi_instance.get_native_connection
>
> at runtime.
True for a Python object, but not for a C extension object. But
subclassing is supported, so one would be able to do:
>>> class MyConnection(psycopg2.extensions.connection):
... _get_native_connection =
psycopg2.extensions.connection.get_native_connection
...
>>> cnn = psycopg2.connect('', connection_factory=MyConnection)
>>> ptr = cnn._get_native_connection()
-- Daniele
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Akshay Joshi | 2018-10-30 12:36:24 | Re: psycopg2 conn.poll() hangs when used with sshtunnel |
| Previous Message | Daniele Varrazzo | 2018-10-29 12:07:44 | Re: Feature branches merged to master for 2.8 release |