Re: Solving the SQL composition problem

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>, "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org>
Subject: Re: Solving the SQL composition problem
Date: 2017-01-02 15:05:16
Message-ID: 86ed1046-7895-a758-f8f2-7dbab82de569@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On 1/1/17 2:11 AM, Daniele Varrazzo wrote:
> sql.SQL("insert into %s values (%%s)") % [sql.Identifier('mytable')],

Since %s isn't standard parameter replacement anyway, I'm wondering if
both considerations could just be handled by execute(), by using
different replacement syntax. IE:

execute('insert into %s values ($1)', [42], ['my table'])

Obviously this would be backwards incompatible, but I think that's
manageable.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Adrian Klaver 2017-01-02 15:16:32 Re: Solving the SQL composition problem
Previous Message Daniele Varrazzo 2017-01-02 13:05:33 Re: speed concerns with executemany()