Re: Use of .mogrify - Mailing list psycopg

From Daniele Varrazzo
Subject Re: Use of .mogrify
Date
Msg-id CA+mi_8b1bB8esZT3PGbEyviFaE0nL+wo3Y8DAhVCipZi8TjLzg@mail.gmail.com
Whole thread Raw
In response to Use of .mogrify  (Tobias Fielitz <tobias@streethawk.com>)
List psycopg
On Thu, Apr 3, 2014 at 1:00 AM, Tobias Fielitz <tobias@streethawk.com> wrote:
> Hi All,
>
> I just stumbled across this conversation:
> http://permalink.gmane.org/gmane.comp.python.db.psycopg.devel/4775
>
> Is .mogrify still just for debugging usage?

That message is still valid: currently mogrify does what you expect
(actually better than it used to do in 2008). But in the future we
don't guarantee that (actually, if we move to sending parameters to
the server, new cursor classes may not have a mogrify method at all).

> I have a query generated by Django's ORM that I would like to execute as
> plain SQL (because I will wrap some SQL around it).

Why don't you wrap the SQL around the query with placeholders and then
pass the parameters?

-- Daniele


psycopg by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Use of .mogrify
Next
From: Daniele Varrazzo
Date:
Subject: Fwd: Please test before psycopg 2.5.3 release