Re: Use of .mogrify

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: tobias(at)streethawk(dot)com
Cc: "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org>
Subject: Re: Use of .mogrify
Date: 2014-04-03 01:55:13
Message-ID: CA+mi_8b1bB8esZT3PGbEyviFaE0nL+wo3Y8DAhVCipZi8TjLzg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: psycopg

On Thu, Apr 3, 2014 at 1:00 AM, Tobias Fielitz <tobias(at)streethawk(dot)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

In response to

Browse psycopg by date

  From Date Subject
Next Message Daniele Varrazzo 2014-04-05 15:29:27 Fwd: Please test before psycopg 2.5.3 release
Previous Message Adrian Klaver 2014-04-03 00:08:54 Re: Use of .mogrify