Re: ISQLQuote vs. str subclass

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Jonathan Rogers <jrogers(at)socialserve(dot)com>
Cc: "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org>
Subject: Re: ISQLQuote vs. str subclass
Date: 2015-07-31 16:08:56
Message-ID: CA+mi_8Y0ZgDAZR--uicRE_KukVJe+kCCnG3fNUb8rJdmtziUKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Fri, Jul 31, 2015 at 3:57 PM, Jonathan Rogers
<jrogers(at)socialserve(dot)com> wrote:
> I have a custom subclass of str called LiteralValue, the purpose of
> which is to represent a string which should be passed to Postgres
> unmodified. Its getquoted() method simply returns itself. This type
> worked as intended with psycopg2 up to version 2.2.x. However, versions
> of psycopg2 2.3 and newer no longer call getquoted() on objects of type
> LiteralValue. Is this an expected change in behavior?

I don't think so, not intentionally at least. If the class is
self-adapting, does it expose a __conform__() method? If it has an
associated wrapper is it registered?

http://initd.org/psycopg/docs/advanced.html#adapting-new-python-types-to-sql-syntax

If you post the implementation I can try and take a look.

-- Daniele

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Jonathan Rogers 2015-07-31 18:53:21 Re: ISQLQuote vs. str subclass
Previous Message Jonathan Rogers 2015-07-31 14:57:37 ISQLQuote vs. str subclass